logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Smith <psm...@aconex.com>
Subject Re: DailyRollingAppender - How does it know when to rollover?
Date Mon, 11 May 2009 11:38:40 GMT
the first logging event _after_ the time period computed should roll  
the file over, however if there is any failure (perhaps because  
another process has the file handle open, a common problem on  
Windows), the rollover can fail, and you'll need to wait to the next  
window (another month).

When the failure occurs, it does log to StdErr (from the source code  
to DailyRollingFileAppender):

   protected void subAppend(LoggingEvent event) {
       long n = System.currentTimeMillis();
       if (n >= nextCheck) {
           now.setTime(n);
           nextCheck = rc.getNextCheckMillis(now);
           try {
               rollOver();
           }
           catch(IOException ioe) {
               if (ioe instanceof InterruptedIOException) {
                   Thread.currentThread().interrupt();
               }
               LogLog.error("rollOver() failed.", ioe);
           }
       }
       super.subAppend(event);
   }

It tries it's best to continue logging until next roll over period.

Paul

On 11/05/2009, at 9:31 PM, Marc Farrow wrote:

>
> This is a fairly simple question.  Does anyone that maintains or  
> create LOG4J
> read these posts anymore?
>
> Thanks.
>
> -- 
> View this message in context: http://www.nabble.com/DailyRollingAppender---How-does-it-know-when-to-rollover--tp23390773p23481523.html
> Sent from the Log4j - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>

Paul Smith
Production Engineering Manager

Aconex
The easy way to save time and money on your project

696 Bourke Street, Melbourne,
VIC 3000, Australia
Tel: +61 3 9240 0200  Fax: +61 3 9240 0299
Email: psmith@aconex.com  www.aconex.com

This email and any attachments are intended solely for the addressee.  
The contents may be privileged, confidential and/or subject to  
copyright or other applicable law. No confidentiality or privilege is  
lost by an erroneous transmission. If you have received this e-mail in  
error, please let us know by reply e-mail and delete or destroy this  
mail and all copies. If you are not the intended recipient of this  
message you must not disseminate, copy or take any action in reliance  
on it. The sender takes no responsibility for the effect of this  
message upon the recipient's computer system.





Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message