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 David Sanders <ds...@chaincast.com> on 2002/02/02 01:28:27 UTC

DailyRollingFileAppender does not rollover when expected to

http://jakarta.apache.org/log4j/docs/api/org/apache/log4j/DailyRollingFileAp
pender.html says:

"For example, if the File option is set to /foo/bar.log and the DatePattern
set to '.'yyyy-MM-dd, on 2001-02-16 at midnight, the logging file /foo/
bar.log will be copied to /foo/bar.log.2001-02-16 and logging for 2001-02-17
will continue in /foo/bar.log until it rolls over the next day"


I don't mean to be picky, but the above statement isn't accurate.  The file
is rolled upon the first log attempt AFTER midnight.  In my application,
there may be no logging between midnight and 5:00 AM.  Yet, I need the files
to be closed and renamed at midnight so a tool can grab them and do billing
based on sessions in the log.

Version 1.15 of DailyRollingFileAppender fixed the "restart" problem, but
did not fix the problem described above.

DailyRollingFileAppender and DatedFileAppender have the same problem, i.e.,
they roll when first log attempt is made after midnight.




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: DailyRollingFileAppender does not rollover when expected to

Posted by John Reed <jo...@perfconn.demon.co.uk>.
My solution was to use a static thread that logged something just after
midnight.

-----Original Message-----
From: David Sanders [mailto:dsanders@chaincast.com]
Sent: 02 February 2002 00:28
To: 'log4j-dev@jakarta.apache.org'
Subject: DailyRollingFileAppender does not rollover when expected to


http://jakarta.apache.org/log4j/docs/api/org/apache/log4j/DailyRollingFileAp
pender.html says:

"For example, if the File option is set to /foo/bar.log and the DatePattern
set to '.'yyyy-MM-dd, on 2001-02-16 at midnight, the logging file /foo/
bar.log will be copied to /foo/bar.log.2001-02-16 and logging for 2001-02-17
will continue in /foo/bar.log until it rolls over the next day"


I don't mean to be picky, but the above statement isn't accurate.  The file
is rolled upon the first log attempt AFTER midnight.  In my application,
there may be no logging between midnight and 5:00 AM.  Yet, I need the files
to be closed and renamed at midnight so a tool can grab them and do billing
based on sessions in the log.

Version 1.15 of DailyRollingFileAppender fixed the "restart" problem, but
did not fix the problem described above.

DailyRollingFileAppender and DatedFileAppender have the same problem, i.e.,
they roll when first log attempt is made after midnight.




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>