-
1. Re: DailyRollingFileAppender and rolling logic
peterj Feb 11, 2013 10:13 AM (in response to venkatap)This is how Log4J works - log files are rolled in a lazy fashion when the first log entry after the split point is written. So the first log entry after midnight will cause Log4J to rename the active log file (e.g. server.log) to a timstamped file name and create a new active log file with that new log entry. There is no timer within Log4J that would cause this to happen exactly at midnight (which would result in an active log file with no entries).
Of course, if you want to force this action, you could write a Quartz job (or some other scheduler job) that runs a second after midnight and writes a log entry; that should force the rollover.
-
2. Re: DailyRollingFileAppender and rolling logic
venkatap Feb 11, 2013 11:08 PM (in response to peterj)Thanks Peter for the response. I wonder why they say "Roll over at Midnight each day" in the documentation. This led to the confusion.