logback-spring.xml 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. ~ Copyright (c) 2018-2025, lengleng All rights reserved.
  4. ~
  5. ~ Redistribution and use in source and binary forms, with or without
  6. ~ modification, are permitted provided that the following conditions are met:
  7. ~
  8. ~ Redistributions of source code must retain the above copyright notice,
  9. ~ this list of conditions and the following disclaimer.
  10. ~ Redistributions in binary form must reproduce the above copyright
  11. ~ notice, this list of conditions and the following disclaimer in the
  12. ~ documentation and/or other materials provided with the distribution.
  13. ~ Neither the name of the pig4cloud.com developer nor the names of its
  14. ~ contributors may be used to endorse or promote products derived from
  15. ~ this software without specific prior written permission.
  16. ~ Author: lengleng ([email protected])
  17. -->
  18. <!--
  19. 小技巧: 在根pom里面设置统一存放路径,统一管理方便维护
  20. <properties>
  21. <log-path>/Users/lengleng</log-path>
  22. </properties>
  23. 1. 其他模块加日志输出,直接copy本文件放在resources 目录即可
  24. 2. 注意修改 <property name="${log-path}/log.path" value=""/> 的value模块
  25. -->
  26. <configuration debug="false" scan="false">
  27. <property name="log.path" value="logs/pig-codegen"/>
  28. <!-- 彩色日志格式 -->
  29. <property name="CONSOLE_LOG_PATTERN"
  30. value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
  31. <property name="FILE_LOG_PATTERN" value=":%d{yyyy-MM-dd HH:mm:ss.SSS} %5p %t %c{1}: %m%n"/>
  32. <!-- 彩色日志依赖的渲染类 -->
  33. <conversionRule conversionWord="clr" class="org.springframework.boot.logging.logback.ColorConverter"/>
  34. <conversionRule conversionWord="wex"
  35. class="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
  36. <conversionRule conversionWord="wEx"
  37. class="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
  38. <!-- Console log output -->
  39. <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
  40. <encoder>
  41. <pattern>${CONSOLE_LOG_PATTERN}</pattern>
  42. </encoder>
  43. </appender>
  44. <!-- Log file debug output -->
  45. <appender name="debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
  46. <file>${log.path}/debug.log</file>
  47. <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
  48. <fileNamePattern>${log.path}/%d{yyyy-MM, aux}/debug.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
  49. <maxFileSize>50MB</maxFileSize>
  50. <maxHistory>30</maxHistory>
  51. </rollingPolicy>
  52. <encoder>
  53. <pattern>${FILE_LOG_PATTERN}</pattern>
  54. </encoder>
  55. </appender>
  56. <!-- Log file error output -->
  57. <appender name="error" class="ch.qos.logback.core.rolling.RollingFileAppender">
  58. <file>${log.path}/error.log</file>
  59. <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
  60. <fileNamePattern>${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
  61. <maxFileSize>50MB</maxFileSize>
  62. <maxHistory>30</maxHistory>
  63. </rollingPolicy>
  64. <encoder>
  65. <pattern>${FILE_LOG_PATTERN}</pattern>
  66. </encoder>
  67. <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
  68. <level>ERROR</level>
  69. </filter>
  70. </appender>
  71. <logger name="org.activiti.engine.impl.db" level="DEBUG">
  72. <appender-ref ref="debug"/>
  73. </logger>
  74. <!--nacos 心跳 INFO 屏蔽-->
  75. <logger name="com.alibaba.nacos" level="OFF">
  76. <appender-ref ref="error"/>
  77. </logger>
  78. <!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
  79. <root level="debug">
  80. <appender-ref ref="console"/>
  81. <appender-ref ref="debug"/>
  82. <appender-ref ref="error"/>
  83. </root>
  84. </configuration>