柯桥增值式服务
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

logback-spring.xml 3.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <configuration scan="true" scanPeriod="10 seconds">
  2. <springProperty name="logPath" scope="context" source="log.path" defaultValue="./logs"/>
  3. <springProperty name="infoFileSize" scope="context" source="log.info.file-size"/>
  4. <springProperty name="infoMaxSize" scope="context" source="log.info.max-size"/>
  5. <springProperty name="infoTotalSize" scope="context" source="log.info.total-size"/>
  6. <springProperty name="errorFileSize" scope="context" source="log.error.file-size"/>
  7. <springProperty name="errorMaxSize" scope="context" source="log.error.max-size"/>
  8. <springProperty name="errorTotalSize" scope="context" source="log.error.total-size"/>
  9. <appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
  10. <File>${logPath}/info.log</File>
  11. <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  12. <fileNamePattern>${logPath}/info-%d{yyyyMMdd}-%i.log</fileNamePattern>
  13. <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
  14. <maxFileSize>${infoFileSize}</maxFileSize>
  15. </timeBasedFileNamingAndTriggeringPolicy>
  16. <maxHistory>${infoMaxSize}</maxHistory>
  17. <totalSizeCap>${infoTotalSize}</totalSizeCap>
  18. </rollingPolicy>
  19. <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
  20. <layout class="ch.qos.logback.classic.PatternLayout">
  21. <Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} -%msg%n
  22. </Pattern>
  23. </layout>
  24. <charset>UTF-8</charset>
  25. </encoder>
  26. </appender>
  27. <appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
  28. <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
  29. <level>ERROR</level>
  30. </filter>
  31. <File>${logPath}/error.log</File>
  32. <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  33. <fileNamePattern>${logPath}/error-%d{yyyyMMdd}-%i.log</fileNamePattern>
  34. <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
  35. <maxFileSize>${errorFileSize}</maxFileSize>
  36. </timeBasedFileNamingAndTriggeringPolicy>
  37. <maxHistory>${errorMaxSize}</maxHistory>
  38. <totalSizeCap>${errorTotalSize}</totalSizeCap>
  39. </rollingPolicy>
  40. <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
  41. <layout class="ch.qos.logback.classic.PatternLayout">
  42. <Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} -%msg%n
  43. </Pattern>
  44. </layout>
  45. <charset>UTF-8</charset>
  46. </encoder>
  47. </appender>
  48. <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
  49. <encoder>
  50. <pattern>
  51. %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} -%msg%n
  52. </pattern>
  53. <charset>UTF-8</charset>
  54. </encoder>
  55. <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
  56. <level>DEBUG</level>
  57. </filter>
  58. </appender>
  59. <root level="INFO">
  60. <appender-ref ref="INFO_FILE"/>
  61. <appender-ref ref="ERROR_FILE"/>
  62. <appender-ref ref="STDOUT"/>
  63. </root>
  64. </configuration>