logback-prod.xml 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <configuration>
  3. <!--info日志-->
  4. <springProperty scope="context" name="LOG_HOME" source="logback.file"/>
  5. <appender name="APP_INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
  6. <!--活动日志输出路径示例-->
  7. <file>${LOG_HOME}/info.log</file>
  8. <append>true</append>
  9. <!--存档日志示例-->
  10. <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
  11. <fileNamePattern>${LOG_HOME}/%d{yyyy-MM-dd}/info-${HOSTNAME}.%i.log.gz</fileNamePattern>
  12. <!--日志大小可自定义-->
  13. <maxFileSize>50MB</maxFileSize>
  14. <!--存档天数可自定义-->
  15. <maxHistory>30</maxHistory>
  16. </rollingPolicy>
  17. <!--统一日志输出格式-->
  18. <encoder charset="UTF-8">
  19. <pattern>%date [%thread] %-5level %logger [%L] - %msg%n</pattern>
  20. </encoder>
  21. </appender>
  22. <!--ERROR日志-->
  23. <appender name="APP_ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
  24. <file>${LOG_HOME}/error.log</file>
  25. <append>true</append>
  26. <filter class="ch.qos.logback.classic.filter.LevelFilter">
  27. <level>ERROR</level>
  28. <onMatch>ACCEPT</onMatch>
  29. <onMismatch>DENY</onMismatch>
  30. </filter>
  31. <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
  32. <fileNamePattern>${LOG_HOME}/%d{yyyy-MM-dd}/error-${HOSTNAME}.%i.log.gz</fileNamePattern>
  33. <!--日志大小可自定义-->
  34. <maxFileSize>50MB</maxFileSize>
  35. <!--存档天数可自定义-->
  36. <maxHistory>30</maxHistory>
  37. </rollingPolicy>
  38. <encoder charset="UTF-8">
  39. <pattern>%date [%thread] %-5level %logger [%L] - %msg%n</pattern>
  40. </encoder>
  41. </appender>
  42. <!--<appender name="CatAppender" class="com.kaola.travel.travel.config.CatLogbackAppender"></appender>-->
  43. <logger name="org.apache.ibatis" level="info" additivity="false">
  44. <appender-ref ref="APP_INFO"/>
  45. <appender-ref ref="APP_ERROR"/>
  46. <!--<appender-ref ref="CatAppender" />-->
  47. </logger>
  48. <logger name="com.mofangchuxing.aska" level="INFO" additivity="false">
  49. <appender-ref ref="APP_INFO"/>
  50. <appender-ref ref="APP_ERROR"/>
  51. <!--<appender-ref ref="CatAppender" />-->
  52. </logger>
  53. <logger name="com.alibaba.dubbo" level="INFO" additivity="false">
  54. <appender-ref ref="APP_INFO"/>
  55. <appender-ref ref="APP_ERROR"/>
  56. <!--<appender-ref ref="CatAppender" />-->
  57. </logger>
  58. <root level="INFO">
  59. <!--<appender-ref ref="CatAppender" />-->
  60. <appender-ref ref="APP_INFO"/>
  61. <appender-ref ref="APP_ERROR"/>
  62. </root>
  63. </configuration>