logback-spring.xml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <configuration>
  3. <!-- log base path -->
  4. <springProperty scope="context" name="logPath" source="logging.basePath"/>
  5. <property name="LOG_HOME" value="${logPath}"/>
  6. <property name="LOG_PATTERN" value="[%d{yyyy-MM-dd HH:mm:ss.SSS}] %highlight(%level) [%thread] %highlight(%logger{100}) - %msg%n"/>
  7. <appender name="LEVEL_GE_INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
  8. <append>true</append>
  9. <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
  10. <level>INFO</level>
  11. </filter>
  12. <file>${LOG_HOME}/log-ge-info.log</file>
  13. <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
  14. <fileNamePattern>${LOG_HOME}/log-ge-info-%i.log</fileNamePattern>
  15. <minIndex>1</minIndex>
  16. <maxIndex>10</maxIndex>
  17. </rollingPolicy>
  18. <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
  19. <maxFileSize>50MB</maxFileSize>
  20. </triggeringPolicy>
  21. <encoder charset="UTF-8">
  22. <pattern>${LOG_PATTERN}</pattern>
  23. <charset>UTF-8</charset>
  24. </encoder>
  25. </appender>
  26. <appender name="LEVEL_GE_WARN" class="ch.qos.logback.core.rolling.RollingFileAppender">
  27. <append>true</append>
  28. <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
  29. <level>WARN</level>
  30. </filter>
  31. <file>${LOG_HOME}/log-ge-warn.log</file>
  32. <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
  33. <fileNamePattern>${LOG_HOME}/log-ge-warn-%i.log</fileNamePattern>
  34. <minIndex>1</minIndex>
  35. <maxIndex>10</maxIndex>
  36. </rollingPolicy>
  37. <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
  38. <maxFileSize>100MB</maxFileSize>
  39. </triggeringPolicy>
  40. <encoder charset="UTF-8">
  41. <pattern>${LOG_PATTERN}</pattern>
  42. <charset>UTF-8</charset>
  43. </encoder>
  44. </appender>
  45. <appender name="LEVEL_GE_DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender">
  46. <append>true</append>
  47. <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
  48. <level>DEBUG</level>
  49. </filter>
  50. <file>${LOG_HOME}/log-ge-debug.log</file>
  51. <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
  52. <fileNamePattern>${LOG_HOME}/log-ge-debug-%i.log</fileNamePattern>
  53. <minIndex>1</minIndex>
  54. <maxIndex>10</maxIndex>
  55. </rollingPolicy>
  56. <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
  57. <maxFileSize>100MB</maxFileSize>
  58. </triggeringPolicy>
  59. <encoder charset="UTF-8">
  60. <pattern>${LOG_PATTERN}</pattern>
  61. <charset>UTF-8</charset>
  62. </encoder>
  63. </appender>
  64. <appender name="LEVEL_GE_ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
  65. <append>true</append>
  66. <filter class="ch.qos.logback.classic.filter.LevelFilter">
  67. <level>ERROR</level>
  68. </filter>
  69. <file>${LOG_HOME}/log-ge-error.log</file>
  70. <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
  71. <fileNamePattern>${LOG_HOME}/log-ge-error-%i.log</fileNamePattern>
  72. <minIndex>1</minIndex>
  73. <maxIndex>5</maxIndex>
  74. </rollingPolicy>
  75. <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
  76. <maxFileSize>100MB</maxFileSize>
  77. </triggeringPolicy>
  78. <encoder charset="UTF-8">
  79. <pattern>${LOG_PATTERN}</pattern>
  80. <charset>UTF-8</charset>
  81. </encoder>
  82. </appender>
  83. <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
  84. <encoder>
  85. <pattern>%-4relative [%thread] %-5level %logger{35} - %msg %n</pattern>
  86. </encoder>
  87. </appender>
  88. <logger name="taiji.hn.axv1" level="TRACE">
  89. <appender-ref ref="LEVEL_GE_INFO"/>
  90. </logger>
  91. <root level="ERROR">
  92. <appender-ref ref="LEVEL_GE_ERROR"/>
  93. </root>
  94. <root level="DEBUG">
  95. <appender-ref ref="LEVEL_GE_DEBUG"/>
  96. </root>
  97. <root level="WARN">
  98. <appender-ref ref="LEVEL_GE_WARN"/>
  99. </root>
  100. </configuration>