logback.xml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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>5MB</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. <!-- 输出日志到控制台-->
  26. <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
  27. <Encoding>UTF-8</Encoding>
  28. <encoder>
  29. <pattern>%d{HH:mm:ss}[%-5level][%file:%line] %msg%n</pattern>
  30. </encoder>
  31. <!-- 不输出定时器输出的日志 -->
  32. <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
  33. <evaluator>
  34. <expression><![CDATA[return logger.contains(".business.quartz");]]></expression>
  35. </evaluator>
  36. <OnMatch>DENY</OnMatch>
  37. <OnMismatch>NEUTRAL</OnMismatch>
  38. </filter>
  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. <!-- <logger name="com.zdsoft.fortunet.model.dao" level="ERROR" additivity="false"/> -->
  48. <logger name="com.zdsoft.rock.common.model.dao" level="ERROR" additivity="false"/>
  49. <logger name="com.zdsoft" level="DEBUG"/>
  50. <root level="ERROR">
  51. <appender-ref ref="STDOUT" />
  52. </root>
  53. </configuration>