How to get log4j to roll files based on date and size

log4j

So log4j comes with two existing log rollers: RollingFileAppender, and DailyRollingFileAppender. Has anyone heard of an appender that does both of what the former do?

I need an appender that will roll log files based on filesize, but also append the current date to it.

I've been thinking about creating my own appender, but if there is already one that has been created, why not save the time and use that one?

Best Answer

Looks like you want a mix of the http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/DailyRollingFileAppender.html and the http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/RollingFileAppender.html.

You'll have to code by yourself. The good news is: you'll just have "merge" those classes functionality, no "low level" new code required.

Related Topic