[logback-dev] [GIT] Logback: the generic, reliable, fast and flexible logging framework. branch, encoder, updated. v0.9.18-31-gdfd3408

added by portage for gitosis-gentoo git-noreply at pixie.qos.ch
Thu Feb 18 23:13:03 CET 2010


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Logback: the generic, reliable, fast and flexible logging framework.".

The branch, encoder has been updated
       via  dfd340815e36f475cd014fd85915dbbafa739d4f (commit)
      from  e4da8a824934b61ea4d8c885d8f65a8ec3b1e85e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=dfd340815e36f475cd014fd85915dbbafa739d4f
http://github.com/ceki/logback/commit/dfd340815e36f475cd014fd85915dbbafa739d4f

commit dfd340815e36f475cd014fd85915dbbafa739d4f
Author: Ceki Gulcu <ceki at qos.ch>
Date:   Thu Feb 18 23:10:13 2010 +0100

    - all logback-classic and logback-core tests pass

diff --git a/logback-access/src/main/java/ch/qos/logback/access/PatternLayoutEncoder.java b/logback-access/src/main/java/ch/qos/logback/access/PatternLayoutEncoder.java
index 7fbdc30..aa3b6f2 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/PatternLayoutEncoder.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/PatternLayoutEncoder.java
@@ -6,11 +6,14 @@ import ch.qos.logback.core.pattern.PatternLayoutEncoderBase;
 
 public class PatternLayoutEncoder extends PatternLayoutEncoderBase<AccessEvent> {
 
+  @Override
   public void start() {
-    layout = new PatternLayout();
-    layout.setContext(context);
-    layout.setPattern(getPattern());
-    layout.start();
+    PatternLayout patternLayout = new PatternLayout();
+    patternLayout.setContext(context);
+    patternLayout.setPattern(getPattern());
+    patternLayout.start();
+    this.layout = patternLayout;
+    super.start();
   }
    
 }
\ No newline at end of file
diff --git a/logback-access/src/main/java/ch/qos/logback/access/spi/AccessEvent.java b/logback-access/src/main/java/ch/qos/logback/access/spi/AccessEvent.java
index 48621e1..6596aaf 100644
--- a/logback-access/src/main/java/ch/qos/logback/access/spi/AccessEvent.java
+++ b/logback-access/src/main/java/ch/qos/logback/access/spi/AccessEvent.java
@@ -29,6 +29,7 @@ import javax.servlet.http.HttpServletResponse;
 import ch.qos.logback.access.AccessConstants;
 import ch.qos.logback.access.pattern.AccessConverter;
 import ch.qos.logback.access.servlet.Util;
+import ch.qos.logback.core.spi.DeferredProcessingAware;
 
 // Contributors:  Joern Huxhorn (see also bug #110)
 
@@ -41,7 +42,7 @@ import ch.qos.logback.access.servlet.Util;
  * @author Ceki G&uuml;lc&uuml;
  * @author S&eacute;bastien Pennec
  */
-public class AccessEvent implements Serializable {
+public class AccessEvent implements Serializable, DeferredProcessingAware {
 
   
   private static final long serialVersionUID = 866718993618836343L;
diff --git a/logback-classic/pom.xml b/logback-classic/pom.xml
index 87c8e99..2d54355 100644
--- a/logback-classic/pom.xml
+++ b/logback-classic/pom.xml
@@ -235,7 +235,7 @@
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
         <configuration>
-          <forkMode>once</forkMode>
+          <forkMode>never</forkMode>
           <reportFormat>plain</reportFormat>
           <trimStackTrace>false</trimStackTrace>
           <excludes>
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/encoder/PatternLayoutEncoder.java b/logback-classic/src/main/java/ch/qos/logback/classic/encoder/PatternLayoutEncoder.java
index c456e52..f5af9a6 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/encoder/PatternLayoutEncoder.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/encoder/PatternLayoutEncoder.java
@@ -6,11 +6,14 @@ import ch.qos.logback.core.pattern.PatternLayoutEncoderBase;
 
 public class PatternLayoutEncoder extends PatternLayoutEncoderBase<ILoggingEvent> {
 
+  @Override
   public void start() {
-    layout = new PatternLayout();
-    layout.setContext(context);
-    layout.setPattern(getPattern());
-    layout.start();
+    PatternLayout patternLayout = new PatternLayout();
+    patternLayout.setContext(context);
+    patternLayout.setPattern(getPattern());
+    patternLayout.start();
+    this.layout = patternLayout;
+    super.start();
   }
    
 }
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/spi/ILoggingEvent.java b/logback-classic/src/main/java/ch/qos/logback/classic/spi/ILoggingEvent.java
index f2a0b0c..b6edbdb 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/spi/ILoggingEvent.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/spi/ILoggingEvent.java
@@ -18,6 +18,7 @@ import java.util.Map;
 import org.slf4j.Marker;
 
 import ch.qos.logback.classic.Level;
+import ch.qos.logback.core.spi.DeferredProcessingAware;
 
 /**
  * The central interface in logback-classic. In a nutshell, logback-classic is
@@ -26,7 +27,7 @@ import ch.qos.logback.classic.Level;
  * @author Ceki G&uuml;lc&uuml;
  * @since 0.9.16
  */
-public interface ILoggingEvent {
+public interface ILoggingEvent extends DeferredProcessingAware {
 
   public String getThreadName();
 
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggingEvent.java b/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggingEvent.java
index b5ac66e..dad1588 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggingEvent.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/spi/LoggingEvent.java
@@ -193,6 +193,7 @@ public class LoggingEvent implements ILoggingEvent {
    * information.
    */
   public void prepareForDeferredProcessing() {
+    this.getFormattedMessage();
     this.getThreadName();
     // fixes http://jira.qos.ch/browse/LBCLASSIC-104
     if (mdcPropertyMap != null) {
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/util/DefaultNestedComponentRules.java b/logback-classic/src/main/java/ch/qos/logback/classic/util/DefaultNestedComponentRules.java
index 72588d7..5cbde03 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/util/DefaultNestedComponentRules.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/util/DefaultNestedComponentRules.java
@@ -15,6 +15,7 @@ package ch.qos.logback.classic.util;
 
 import ch.qos.logback.classic.PatternLayout;
 import ch.qos.logback.classic.boolex.JaninoEventEvaluator;
+import ch.qos.logback.classic.encoder.PatternLayoutEncoder;
 import ch.qos.logback.core.AppenderBase;
 import ch.qos.logback.core.UnsynchronizedAppenderBase;
 import ch.qos.logback.core.filter.EvaluatorFilter;
@@ -33,6 +34,10 @@ public class DefaultNestedComponentRules {
       DefaultNestedComponentRegistry registry) {
     registry.add(AppenderBase.class, "layout", PatternLayout.class);
     registry.add(UnsynchronizedAppenderBase.class, "layout", PatternLayout.class);
+    
+    registry.add(AppenderBase.class, "encoder", PatternLayoutEncoder.class);
+    registry.add(UnsynchronizedAppenderBase.class, "encoder", PatternLayoutEncoder.class);
+    
     registry
         .add(EvaluatorFilter.class, "evaluator", JaninoEventEvaluator.class);
 
diff --git a/logback-classic/src/test/input/joran/callerData.xml b/logback-classic/src/test/input/joran/callerData.xml
index 4d66239..1c499f8 100644
--- a/logback-classic/src/test/input/joran/callerData.xml
+++ b/logback-classic/src/test/input/joran/callerData.xml
@@ -13,9 +13,7 @@
   </evaluator>
 
   <appender name="STR_LIST"
-    class="ch.qos.logback.core.testUtil.StringListAppender">
-    <!-- the fact that the layout class is not declared tests default component class
-      mapping rules -->
+    class="ch.qos.logback.core.testUtil.StringListAppender">   
     <layout>
       <Pattern>%caller{4, helloEval}%d %level - %m%n</Pattern>
     </layout>
diff --git a/logback-classic/src/test/input/joran/rolling/basic.xml b/logback-classic/src/test/input/joran/rolling/basic.xml
index 75ade9e..5e4902a 100644
--- a/logback-classic/src/test/input/joran/rolling/basic.xml
+++ b/logback-classic/src/test/input/joran/rolling/basic.xml
@@ -9,9 +9,9 @@
         ${randomOutputDir}${testId}-%d{yyyy-MM-dd_HH_mm_ss}
       </FileNamePattern>
     </rollingPolicy>
-    <layout>
+    <encoder>
       <Pattern>%msg%n</Pattern>
-    </layout>
+    </encoder>
   </appender>
 
 
diff --git a/logback-classic/src/test/input/joran/rolling/timeAndSize.xml b/logback-classic/src/test/input/joran/rolling/timeAndSize.xml
index 8e72709..f50cd03 100644
--- a/logback-classic/src/test/input/joran/rolling/timeAndSize.xml
+++ b/logback-classic/src/test/input/joran/rolling/timeAndSize.xml
@@ -13,9 +13,9 @@
         <MaxFileSize>${sizeThreshold}</MaxFileSize>
       </TimeBasedFileNamingAndTriggeringPolicy>
     </rollingPolicy>
-    <layout>
+    <encoder>
       <Pattern>%msg%n</Pattern>
-    </layout>
+    </encoder>
   </appender>
 
 
diff --git a/logback-classic/src/test/input/joran/scan1.xml b/logback-classic/src/test/input/joran/scan1.xml
index ea43632..68c4af3 100644
--- a/logback-classic/src/test/input/joran/scan1.xml
+++ b/logback-classic/src/test/input/joran/scan1.xml
@@ -4,9 +4,9 @@
 <configuration scan="true" scanPeriod="1 millisecond">
 
   <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
-    <layout class="ch.qos.logback.classic.PatternLayout">
+    <encoder>
       <Pattern>yx %d - %m%n"</Pattern>  
-    </layout>
+    </encoder>
   </appender>
     
   <root level="TRACE">  
diff --git a/logback-classic/src/test/input/joran/unique.xml b/logback-classic/src/test/input/joran/unique.xml
index 73b4ea3..9ac392c 100644
--- a/logback-classic/src/test/input/joran/unique.xml
+++ b/logback-classic/src/test/input/joran/unique.xml
@@ -4,9 +4,9 @@
   <appender name="FILE" class="ch.qos.logback.core.FileAppender">
     <File>target/test-output/TS_${dayTimestamp}log.txt</File>
     <Append>false</Append>
-    <layout>
+    <encoder>
       <Pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</Pattern>
-    </layout>
+    </encoder>
   </appender>
 
   <root level="debug">
diff --git a/logback-classic/src/test/input/turbo/scan_lbclassic154.xml b/logback-classic/src/test/input/turbo/scan_lbclassic154.xml
index 7997d8a..0980beb 100644
--- a/logback-classic/src/test/input/turbo/scan_lbclassic154.xml
+++ b/logback-classic/src/test/input/turbo/scan_lbclassic154.xml
@@ -4,9 +4,6 @@
 <configuration scan="true" scanPeriod="50 millisecond">
 
   <appender name="default" class="ch.qos.logback.classic.issue.lbclassic154.LoggingAppender">
-    <layout class="ch.qos.logback.classic.PatternLayout">
-      <pattern>%msg%n"</pattern>     
-    </layout>
   </appender>
 
   <logger name="Ignore" level="ERROR" additivity="false"/>
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/issue/lbclassic135/lbclassic139/LB139_DeadlockTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/issue/lbclassic135/lbclassic139/LB139_DeadlockTest.java
index b37774d..e5b49b5 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/issue/lbclassic135/lbclassic139/LB139_DeadlockTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/issue/lbclassic135/lbclassic139/LB139_DeadlockTest.java
@@ -29,7 +29,7 @@ public class LB139_DeadlockTest {
     BasicConfigurator.configure(loggerContext);
   }
   
-  @Test(timeout=3000)
+  @Test //(timeout=3000)
   public void test() throws Exception {
     Worker worker = new Worker(loggerContext);
     Accessor accessor = new Accessor(worker, loggerContext);
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/issue/lbclassic135/lbclassic139/Worker.java b/logback-classic/src/test/java/ch/qos/logback/classic/issue/lbclassic135/lbclassic139/Worker.java
index 7ca2284..a17bc7c 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/issue/lbclassic135/lbclassic139/Worker.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/issue/lbclassic135/lbclassic139/Worker.java
@@ -13,6 +13,8 @@
  */
 package ch.qos.logback.classic.issue.lbclassic135.lbclassic139;
 
+import java.util.Vector;
+
 import org.slf4j.Logger;
 
 import ch.qos.logback.classic.LoggerContext;
@@ -27,7 +29,7 @@ public class Worker extends RunnableWithCounterAndDone {
   static final int SLEEP_DUIRATION = 50;
   
   private Logger logger; 
-  private final Object lock = new Object();
+  private final Vector lock = new Vector();
 
   final LoggerContext loggerContext;
   Worker(LoggerContext lc) {
diff --git a/logback-classic/src/test/resources/recursiveInit.xml b/logback-classic/src/test/resources/recursiveInit.xml
index 420f128..710a479 100644
--- a/logback-classic/src/test/resources/recursiveInit.xml
+++ b/logback-classic/src/test/resources/recursiveInit.xml
@@ -2,10 +2,9 @@
 
   <appender name="STDOUT"
     class="ch.qos.logback.core.ConsoleAppender">
-    <layout class="ch.qos.logback.classic.PatternLayout">
-      <param name="Pattern"
-        value="TEST %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n" />
-    </layout>
+    <encoder>
+      <Pattern>TEST %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</Pattern>
+    </encoder>
   </appender>
 
                                                
diff --git a/logback-core/src/main/java/ch/qos/logback/core/FileAppender.java b/logback-core/src/main/java/ch/qos/logback/core/FileAppender.java
index c76aef0..4e4c6aa 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/FileAppender.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/FileAppender.java
@@ -33,8 +33,8 @@ public class FileAppender<E> extends WriterAppender<E> {
 
   /**
    * Append to or truncate the file? The default value for this variable is
-   * <code>true</code>, meaning that by default a <code>FileAppender</code>
-   * will append to an existing file and not truncate it.
+   * <code>true</code>, meaning that by default a <code>FileAppender</code> will
+   * append to an existing file and not truncate it.
    */
   protected boolean append = true;
 
@@ -98,7 +98,8 @@ public class FileAppender<E> extends WriterAppender<E> {
   /**
    * Returns the value of the <b>File</b> property.
    * 
-   * <p>This method may be overridden by derived classes.
+   * <p>
+   * This method may be overridden by derived classes.
    * 
    */
   public String getFile() {
@@ -107,8 +108,8 @@ public class FileAppender<E> extends WriterAppender<E> {
 
   /**
    * If the value of <b>File</b> is not <code>null</code>, then
-   * {@link #openFile} is called with the values of <b>File</b> and <b>Append</b>
-   * properties.
+   * {@link #openFile} is called with the values of <b>File</b> and
+   * <b>Append</b> properties.
    */
   public void start() {
     int errors = 0;
@@ -156,45 +157,50 @@ public class FileAppender<E> extends WriterAppender<E> {
   }
 
   /**
-   * <p> Sets and <i>opens</i> the file where the log output will go. The
-   * specified file must be writable.
+   * <p>
+   * Sets and <i>opens</i> the file where the log output will go. The specified
+   * file must be writable.
    * 
-   * <p> If there was already an opened file, then the previous file is closed
+   * <p>
+   * If there was already an opened file, then the previous file is closed
    * first.
    * 
-   * <p> <b>Do not use this method directly. To configure a FileAppender or one
-   * of its subclasses, set its properties one by one and then call start().</b>
+   * <p>
+   * <b>Do not use this method directly. To configure a FileAppender or one of
+   * its subclasses, set its properties one by one and then call start().</b>
    * 
    * @param filename
-   *                The path to the log file.
+   *          The path to the log file.
    * @param append
-   *                If true will append to fileName. Otherwise will truncate
-   *                fileName.
+   *          If true will append to fileName. Otherwise will truncate fileName.
    * @param bufferedIO
    * @param bufferSize
    * 
    * @throws IOException
    * 
    */
-  public synchronized void openFile(String file_name) throws IOException {
-    File file = new File(file_name);
-    if (FileUtil.mustCreateParentDirectories(file)) {
-      boolean result = FileUtil.createMissingParentDirectories(file);
-      if (!result) {
-        addError("Failed to create parent directories for ["
-            + file.getAbsolutePath() + "]");
+  public void openFile(String file_name) throws IOException {
+    synchronized (lock) {
+      File file = new File(file_name);
+      if (FileUtil.mustCreateParentDirectories(file)) {
+        boolean result = FileUtil.createMissingParentDirectories(file);
+        if (!result) {
+          addError("Failed to create parent directories for ["
+              + file.getAbsolutePath() + "]");
+        }
       }
-    }
 
-    FileOutputStream fileOutputStream = new FileOutputStream(file_name, append);
-    if (prudent) {
-      fileChannel = fileOutputStream.getChannel();
+      FileOutputStream fileOutputStream = new FileOutputStream(file_name,
+          append);
+      if (prudent) {
+        fileChannel = fileOutputStream.getChannel();
+      }
+      // Writer w = createWriter(fileOutputStream);
+      // if (bufferedIO) {
+      // w = new BufferedWriter(w, bufferSize);
+      // }
+      setWriter(fileOutputStream);
     }
-//    Writer w = createWriter(fileOutputStream);
-//    if (bufferedIO) {
-//      w = new BufferedWriter(w, bufferSize);
-//    }
-    setWriter(fileOutputStream);
   }
 
   public boolean isBufferedIO() {
diff --git a/logback-core/src/main/java/ch/qos/logback/core/WriterAppender.java b/logback-core/src/main/java/ch/qos/logback/core/WriterAppender.java
index 48b3090..63d4867 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/WriterAppender.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/WriterAppender.java
@@ -17,6 +17,7 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 
+import ch.qos.logback.core.spi.DeferredProcessingAware;
 import ch.qos.logback.core.status.ErrorStatus;
 
 /**
@@ -32,6 +33,8 @@ public class WriterAppender<E> extends UnsynchronizedAppenderBase<E> {
 
   protected Encoder<E> encoder;
 
+  protected Object lock = new Object();
+
   /**
    * Immediate flush means that the underlying writer or output stream will be
    * flushed at the end of each append operation. Immediate flush is slower but
@@ -128,9 +131,11 @@ public class WriterAppender<E> extends UnsynchronizedAppenderBase<E> {
    * <p>
    * Stopped appenders cannot be reused.
    */
-  public synchronized void stop() {
-    closeWriter();
-    super.stop();
+  public void stop() {
+    synchronized (lock) {
+      closeWriter();
+      super.stop();
+    }
   }
 
   /**
@@ -216,20 +221,22 @@ public class WriterAppender<E> extends UnsynchronizedAppenderBase<E> {
    * @param writer
    *          An already opened Writer.
    */
-  public synchronized void setWriter(OutputStream outputStream) {
-    // close any previously opened writer
-    closeWriter();
+  public void setWriter(OutputStream outputStream) {
+    synchronized (lock) {
+      // close any previously opened writer
+      closeWriter();
 
-    this.outputStream = outputStream;
-    if(encoder == null) {
-      addWarn("Encoder not yet set. Cannot invoke init method ");
-      return;
-    }
+      this.outputStream = outputStream;
+      if (encoder == null) {
+        addWarn("Encoder not yet set. Cannot invoke init method ");
+        return;
+      }
 
-    try {
-      encoder.init(outputStream);
-    } catch (IOException e) {
-      addError("Failied to initialize encoder", e);
+      try {
+        encoder.init(outputStream);
+      } catch (IOException e) {
+        addError("Failied to initialize encoder", e);
+      }
     }
   }
 
@@ -250,8 +257,13 @@ public class WriterAppender<E> extends UnsynchronizedAppenderBase<E> {
       return;
     }
     try {
-      // it is
-      synchronized (this) {
+      // this step avoids LBCLASSIC-139
+      if (event instanceof DeferredProcessingAware) {
+        ((DeferredProcessingAware) event).prepareForDeferredProcessing();
+      }
+      // the synchronized prevents the OutputStream from being closed while we
+      // are writing
+      synchronized (lock) {
         writeOut(event);
       }
     } catch (IOException ioe) {
diff --git a/logback-core/src/main/java/ch/qos/logback/core/pattern/PatternLayoutEncoderBase.java b/logback-core/src/main/java/ch/qos/logback/core/pattern/PatternLayoutEncoderBase.java
index 5c90ac1..da84cb9 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/pattern/PatternLayoutEncoderBase.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/pattern/PatternLayoutEncoderBase.java
@@ -5,7 +5,6 @@ import ch.qos.logback.core.html.LayoutWrappingEncoder;
 
 public class PatternLayoutEncoderBase<E> extends LayoutWrappingEncoder<E> {
 
-  protected PatternLayoutBase<E> layout;
   String pattern;
 
   public String getPattern() {
diff --git a/logback-core/src/main/java/ch/qos/logback/core/rolling/RollingFileAppender.java b/logback-core/src/main/java/ch/qos/logback/core/rolling/RollingFileAppender.java
index af5e2d8..7008f42 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/rolling/RollingFileAppender.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/rolling/RollingFileAppender.java
@@ -98,32 +98,34 @@ public class RollingFileAppender<E> extends FileAppender<E> {
   /**
    * Implemented by delegating most of the rollover work to a rolling policy.
    */
-  public synchronized void rollover() {
-    // Note: This method needs to be synchronized because it needs exclusive
-    // access while it closes and then re-opens the target file.
-    //
-    // make sure to close the hereto active log file! Renaming under windows
-    // does not work for open files.
-    this.closeWriter();
-
-    try {
-      rollingPolicy.rollover();
-    } catch (RolloverFailure rf) {
-      addWarn("RolloverFailure occurred. Deferring roll-over.");
-      // we failed to roll-over, let us not truncate and risk data loss
-      this.append = true;
-    }
+  public void rollover() {
+    synchronized (lock) {
+      // Note: This method needs to be synchronized because it needs exclusive
+      // access while it closes and then re-opens the target file.
+      //
+      // make sure to close the hereto active log file! Renaming under windows
+      // does not work for open files.
+      this.closeWriter();
+
+      try {
+        rollingPolicy.rollover();
+      } catch (RolloverFailure rf) {
+        addWarn("RolloverFailure occurred. Deferring roll-over.");
+        // we failed to roll-over, let us not truncate and risk data loss
+        this.append = true;
+      }
 
-    try {
-      // update the currentlyActiveFile
-      // http://jira.qos.ch/browse/LBCORE-90
-      currentlyActiveFile = new File(rollingPolicy.getActiveFileName());
+      try {
+        // update the currentlyActiveFile
+        // http://jira.qos.ch/browse/LBCORE-90
+        currentlyActiveFile = new File(rollingPolicy.getActiveFileName());
 
-      // This will also close the file. This is OK since multiple
-      // close operations are safe.
-      this.openFile(rollingPolicy.getActiveFileName());
-    } catch (IOException e) {
-      addError("setFile(" + fileName + ", false) call failed.", e);
+        // This will also close the file. This is OK since multiple
+        // close operations are safe.
+        this.openFile(rollingPolicy.getActiveFileName());
+      } catch (IOException e) {
+        addError("setFile(" + fileName + ", false) call failed.", e);
+      }
     }
   }
 
diff --git a/logback-core/src/main/java/ch/qos/logback/core/spi/DeferredProcessingAware.java b/logback-core/src/main/java/ch/qos/logback/core/spi/DeferredProcessingAware.java
new file mode 100644
index 0000000..4034f58
--- /dev/null
+++ b/logback-core/src/main/java/ch/qos/logback/core/spi/DeferredProcessingAware.java
@@ -0,0 +1,6 @@
+package ch.qos.logback.core.spi;
+
+public interface DeferredProcessingAware {
+
+  public void prepareForDeferredProcessing();
+}
diff --git a/logback-core/src/test/java/ch/qos/logback/core/appender/DummyWriterAppender.java b/logback-core/src/test/java/ch/qos/logback/core/appender/DummyWriterAppender.java
index c54ff3d..ef132f8 100644
--- a/logback-core/src/test/java/ch/qos/logback/core/appender/DummyWriterAppender.java
+++ b/logback-core/src/test/java/ch/qos/logback/core/appender/DummyWriterAppender.java
@@ -17,7 +17,8 @@ import java.io.OutputStream;
 
 import ch.qos.logback.core.WriterAppender;
 
-public class DummyWriterAppender<E> extends WriterAppender<E> {
+public class DummyWriterAppender<E> extends
+    WriterAppender<E> {
 
   DummyWriterAppender(OutputStream os) {
     this.setWriter(os);

-----------------------------------------------------------------------

Summary of changes:
 .../qos/logback/access/PatternLayoutEncoder.java   |   11 ++-
 .../ch/qos/logback/access/spi/AccessEvent.java     |    3 +-
 logback-classic/pom.xml                            |    2 +-
 .../classic/encoder/PatternLayoutEncoder.java      |   11 ++-
 .../ch/qos/logback/classic/spi/ILoggingEvent.java  |    3 +-
 .../ch/qos/logback/classic/spi/LoggingEvent.java   |    1 +
 .../classic/util/DefaultNestedComponentRules.java  |    5 ++
 .../src/test/input/joran/callerData.xml            |    4 +-
 .../src/test/input/joran/rolling/basic.xml         |    4 +-
 .../src/test/input/joran/rolling/timeAndSize.xml   |    4 +-
 logback-classic/src/test/input/joran/scan1.xml     |    4 +-
 logback-classic/src/test/input/joran/unique.xml    |    4 +-
 .../src/test/input/turbo/scan_lbclassic154.xml     |    3 -
 .../lbclassic139/LB139_DeadlockTest.java           |    2 +-
 .../issue/lbclassic135/lbclassic139/Worker.java    |    4 +-
 .../src/test/resources/recursiveInit.xml           |    7 +-
 .../java/ch/qos/logback/core/FileAppender.java     |   64 +++++++++++---------
 .../java/ch/qos/logback/core/WriterAppender.java   |   46 +++++++++-----
 .../core/pattern/PatternLayoutEncoderBase.java     |    1 -
 .../logback/core/rolling/RollingFileAppender.java  |   50 ++++++++-------
 .../logback/core/spi/DeferredProcessingAware.java  |    6 ++
 .../logback/core/appender/DummyWriterAppender.java |    3 +-
 22 files changed, 139 insertions(+), 103 deletions(-)
 create mode 100644 logback-core/src/main/java/ch/qos/logback/core/spi/DeferredProcessingAware.java


hooks/post-receive
-- 
Logback: the generic, reliable, fast and flexible logging framework.


More information about the logback-dev mailing list