目前Log4j內建有:
- RollingFileApender ( http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/RollingFileAppender.html )
- DailyRollingFileApender ( http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/DailyRollingFileAppender.html )
Extra提供有:
- rolling.RollingFileAppender ( http://logging.apache.org/log4j/companions/extras/apidocs/org/apache/log4j/rolling/RollingFileAppender.html ) [可配合 FixedWindowRollingPolicy 或是 TimeBasedRollingPolicy 使用]
還不夠合用? 可以試試下面的 TimeAndSizeRollingAppender : Time-and-Size Rolling, Scavenging Appender (http://www.simonsite.org.uk/)
另外log4j.xml設定檔範例可見:
http://wiki.apache.org/logging-log4j/Log4jXmlFormat