ceki        2004/11/18 03:46:06

  Modified:    src/java/org/apache/log4j DailyRollingFileAppender.java
  Log:
  LogLog -> Logger
  
  Revision  Changes    Path
  1.30      +28 -35    
logging-log4j/src/java/org/apache/log4j/DailyRollingFileAppender.java
  
  Index: DailyRollingFileAppender.java
  ===================================================================
  RCS file: 
/home/cvs/logging-log4j/src/java/org/apache/log4j/DailyRollingFileAppender.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- DailyRollingFileAppender.java     3 Jun 2004 13:58:12 -0000       1.29
  +++ DailyRollingFileAppender.java     18 Nov 2004 11:46:06 -0000      1.30
  @@ -16,7 +16,6 @@
   
   package org.apache.log4j;
   
  -import org.apache.log4j.helpers.LogLog;
   import org.apache.log4j.rolling.helpers.RollingCalendar;
   import org.apache.log4j.spi.LoggingEvent;
   
  @@ -30,27 +29,25 @@
   
   
   /**
  -   DailyRollingFileAppender extends [EMAIL PROTECTED] FileAppender} so that 
the
  -   underlying file is rolled over at a user chosen frequency.
  -
  -   <p>The rolling schedule is specified by the <b>DatePattern</b>
  -   option. This pattern should follow the [EMAIL PROTECTED] SimpleDateFormat}
  -   conventions. In particular, you <em>must</em> escape literal text
  -   within a pair of single quotes. A formatted version of the date
  -   pattern is used as the suffix for the rolled file name.
  -
  -   <p>For example, if the <b>File</b> option is set to
  -   <code>/foo/bar.log</code> and the <b>DatePattern</b> set to
  -   <code>.yyyy-MM-dd</code>, on 2001-02-16 at midnight, the logging
  -   file <code>/foo/bar.log</code> will be copied to
  -   <code>/foo/bar.log.2001-02-16</code> and logging for 2001-02-17
  -   will continue in <code>/foo/bar.log</code> until it rolls over
  -   the next day.
  -
  -   <p>Is is possible to specify monthly, weekly, half-daily, daily,
  -   hourly, or minutely rollover schedules.
  -
  -   <p><table border="1" cellpadding="2">
  + * DailyRollingFileAppender extends [EMAIL PROTECTED] FileAppender} so that 
the 
  + * underlying file is rolled over at a user chosen frequency.
  + * 
  + * <p>The rolling schedule is specified by the <b>DatePattern</b> option. 
This 
  + * pattern should follow the [EMAIL PROTECTED] SimpleDateFormat} 
conventions. In 
  + * particular, you <em>must</em> escape literal text within a pair of single 
  + * quotes. A formatted version of the date pattern is used as the suffix for 
  + * the rolled file name. 
  + * 
  + * <p>For example, if the <b>File</b> option is set to 
<code>/foo/bar.log</code> 
  + * and the <b>DatePattern</b> set to <code>.yyyy-MM-dd</code>, on 2001-02-16 
at 
  + * midnight, the logging file <code>/foo/bar.log</code> will be copied to 
  + * <code>/foo/bar.log.2001-02-16</code> and logging for 2001-02-17 will 
continue
  + * in <code>/foo/bar.log</code> until it rolls over the next day.
  + * 
  + * <p>Is is possible to specify monthly, weekly, half-daily, daily, hourly, 
  + * or minutely rollover schedules.
  + * 
  + * <p><table border="1" cellpadding="2">
      <tr>
      <th>DatePattern</th>
      <th>Rollover schedule</th>
  @@ -208,12 +205,12 @@
         rc.setType(type);
   
         File file = new File(fileName);
  -      LogLog.info("fileane is "+fileName);
  -      LogLog.info("sdf is "+sdf);
  +      getLogger().info("fileane is {}.",fileName);
  +      getLogger().info("sdf is {}.",sdf);
         
         scheduledFilename = fileName + sdf.format(new 
Date(file.lastModified()));
       } else {
  -      LogLog.error(
  +      getLogger().error(
           "Either File or DatePattern options are not set for appender [" + 
name
           + "].");
       }
  @@ -250,16 +247,12 @@
         target.delete();
       }
   
  -    File file = new File(fileName);
  -    boolean result = file.renameTo(target);
  -
  -    if (result) {
  -      LogLog.debug(fileName + " -> " + scheduledFilename);
  -    } else {
  -      LogLog.error(
  -        "Failed to rename [" + fileName + "] to [" + scheduledFilename + 
"].");
  +    try {
  +      org.apache.log4j.rolling.helpers.Util.rename(fileName, 
scheduledFilename);
  +    } catch (org.apache.log4j.rolling.RolloverFailure rfE) {
  +      getLogger().error("Failed to rename ["+fileName+"] as 
["+scheduledFilename+"].");
       }
  -
  +    
       try {
         // This will also close the file. This is OK since multiple
         // close operations are safe.
  @@ -289,7 +282,7 @@
         try {
           rollOver();
         } catch (IOException ioe) {
  -        LogLog.error("rollOver() failed.", ioe);
  +        getLogger().error("rollOver() failed.", ioe);
         }
       }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to