Tuesday, 18 May 2010
Roll Log4J log files on application startup
A fairly popular feature request for the TimeAndSizeRollingAppender has been to provide the capability to roll a log file when the application starts up. This can be useful if an application is restarted during a period which falls within a logging interval, and when the most recently written log file is smaller than would be needed to trigger a rollover. In response to requests, I've added this feature into the latest release, available from www.simonsite.org.uk. By default, the appender will continue to behave as it has always done. To turn on the rollover on startup feature, somewhat predictably the appender should be configured with the property RollOnStartup set to true.