logback.xml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <configuration>
  3. <!-- <property name="LOGHOME" value="/alidata1/app/tomcat/logs" /> -->
  4. <property name="LOGHOME" value="/Users/nnyin/log" />
  5. <!-- <property name="LOGHOME" value="d:/temp/logs" /> -->
  6. <!-- 输出日志到文件 -->
  7. <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
  8. <Encoding>UTF-8</Encoding>
  9. <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  10. <FileNamePattern>${LOGHOME}/app.%d{yyyy-MM-dd}.log</FileNamePattern>
  11. </rollingPolicy>
  12. <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
  13. <maxFileSize>500MB</maxFileSize>
  14. </triggeringPolicy>
  15. <encoder>
  16. <Pattern>[%date{yyyy-MM-dd HH:mm:ss}][%-5level][%file:%line] %msg%n</Pattern>
  17. </encoder>
  18. <filter class="ch.qos.logback.classic.filter.LevelFilter">
  19. <level>ERROR</level>
  20. <onMatch>ACCEPT</onMatch>
  21. <onMismatch>DENY</onMismatch>
  22. </filter>
  23. </appender>
  24. <!-- 输出日志到控制台-->
  25. <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
  26. <Encoding>UTF-8</Encoding>
  27. <encoder>
  28. <pattern>%d{HH:mm:ss}[%-5level][%file:%line] %msg%n</pattern>
  29. </encoder>
  30. <!-- 不输出定时器输出的日志
  31. <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
  32. <evaluator>
  33. <expression><![CDATA[return logger.contains(".business.quartz");]]></expression>
  34. </evaluator>
  35. <OnMatch>DENY</OnMatch>
  36. <OnMismatch>NEUTRAL</OnMismatch>
  37. </filter>
  38. -->
  39. <!-- 只允许打印错误日志NEUTRAL,DENY,ACCEPT
  40. <filter class="ch.qos.logback.classic.filter.LevelFilter">
  41. <level>ERROR</level>
  42. <onMatch>ACCEPT</onMatch>
  43. <onMismatch>DENY</onMismatch>
  44. </filter>
  45. -->
  46. </appender>
  47. <root level="DEBUG">
  48. <appender-ref ref="STDOUT" />
  49. <appender-ref ref="FILE" />
  50. </root>
  51. <!--additivity禁止向上传递
  52. <logger name="com.zdsoft.fortunet.model.dao" level="ERROR" additivity="false"/>
  53. <logger name="com.zdsoft.rock.common.model.dao" level="ERROR" additivity="false"/>
  54. -->
  55. </configuration>