log4j.xml 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <configuration>
  3. <appender enabled="true" name="console">
  4. <type>console</type>
  5. <pattern>[%D %T] [%L] (%S) %M</pattern>
  6. <!-- level is (:?FINEST|FINE|DEBUG|TRACE|INFO|WARNING|ERROR) -->
  7. </appender>
  8. <appender enabled="true" name="file">
  9. <type>file</type>
  10. <pattern>[%D %T] [%L] (%S) %M</pattern>
  11. <property name="filename">./logs/confrontation_training.log</property>
  12. <!--
  13. %T - Time (15:04:05 MST)
  14. %t - Time (15:04)
  15. %D - Date (2006/01/02)
  16. %d - Date (01/02/06)
  17. %L - Level (FNST, FINE, DEBG, TRAC, WARN, EROR, CRIT)
  18. %S - Source
  19. %M - Message
  20. It ignores unknown format strings (and removes them)
  21. Recommended: "[%D %T] [%L] (%S) %M"
  22. -->
  23. <property name="rotate">true</property>
  24. <!-- true enables log rotation, otherwise append -->
  25. <property name="maxsize">10M</property>
  26. <!-- \d+[KMG]? Suffixes are in terms of 2**10 -->
  27. <property name="maxlines">10K</property>
  28. <!-- \d+[KMG]? Suffixes are in terms of thousands -->
  29. <property name="daily">true</property>
  30. <!-- Automatically rotates when a log message is written after midnight -->
  31. </appender>
  32. <!-- 输出级别是info级别及以上的日志,下面的ref关联的两个appender没有filter设置,
  33. 所以,info及以上的日志都是会输出到这2个appender的 -->
  34. <root>
  35. <level>info</level>
  36. <appender-ref ref="file" />
  37. <appender-ref ref="console" />
  38. </root>
  39. </configuration>