tags:

views:

611

answers:

3

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?

+1  A: 

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.

razenha
I ended up creating my own FileAppender, which is just a RollingFileAppender that adds the current date on each rolled file.
Jose Chavez
+1  A: 

I know this post is a bit late but you could try out the TimeAndSizeRollingAppender. It's freely available under the Apache 2.0 license, download it from www.simonsite.org.uk.

Simon
A: 

Thanks simon. It works great..