You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Arne Vandamme <ar...@foreach.be> on 2012/01/24 09:36:49 UTC

Contribution to RollingFileAppender (log4j-extras)

Hi,

This applies to log4j-extras (1.1).
We use the RollingFileAppender with TimeBasedRollingPolicy in several of our applications.  But we like to group all logfiles on date in separate directories.  In our case it's simply because it's easier to browse them that way.

Eg:

-          2011/05/05/

o   pages.log

o   methods.log

-          2011/05/06/

o   pages.log

o   methods.log

Apparently the RollingFileAppender does not rollover in this case because the parent directories do not exist and the RollingFileAppender does not try to create them.
In attach a small patch file that modifies RollingFileAppender to create all parent directories in case of a rollover (+ a small test added to TimeBasedRollingPolicy).

I do not know if this is eligible or useful to be added to the trunk of log4j-extras.  It would be handy to know in order to know to switch back to either snapshot or a release of the extras lib.  Not that I'm expecting a new stable release anytime soon ;-)

Best regards,
Arne Vandamme