logback.xml 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <configuration>
  3. <appender name="FILE"
  4. class="ch.qos.logback.core.rolling.RollingFileAppender">
  5. <Encoding>UTF-8</Encoding>
  6. <File>work/log/app.log</File>
  7. <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  8. <FileNamePattern>work/log/app.%d{yyyy-MM-dd}.log.gz</FileNamePattern>
  9. <MaxHistory>30</MaxHistory>
  10. </rollingPolicy>
  11. <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
  12. <pattern>%d{HH:mm:ss} %-5level [%thread]%logger{16} - %msg%n
  13. </pattern>
  14. </encoder>
  15. </appender>
  16. <property resource="config.properties" />
  17. <appender name="EMAIL" class="ch.qos.logback.classic.net.SMTPAppender">
  18. <smtpHost>${logback.email.smtp_host}</smtpHost>
  19. <smtpPort>${logback.email.smtp_port}</smtpPort>
  20. <username>${logback.email.username}</username>
  21. <password>${logback.email.password}</password>
  22. <asynchronousSending>true</asynchronousSending>
  23. <SSL>${logback.email.ssl}</SSL>
  24. <from>${logback.email.from}</from>
  25. <to>${logback.email.to}</to>
  26. <subject>${logback.email.subject}</subject>
  27. <layout class="ch.qos.logback.classic.html.HTMLLayout">
  28. <Pattern>%date%level%thread%logger{0}%line%message</Pattern>
  29. </layout>
  30. <filter class="ch.qos.logback.classic.filter.LevelFilter">
  31. <level>ERROR</level>
  32. <onMatch>ACCEPT</onMatch>
  33. <onMismatch>DENY</onMismatch>
  34. </filter>
  35. <cyclicBufferTracker class="ch.qos.logback.core.spi.CyclicBufferTracker">
  36. <bufferSize>1</bufferSize>
  37. </cyclicBufferTracker>
  38. </appender>
  39. <root level="WARN">
  40. <appender-ref ref="FILE"/>
  41. </root>
  42. </configuration>