[logback-dev] [GIT] Logback: the generic, reliable, fast and flexible logging framework. branch master updated. v_1.0.0-50-gc0d9b3b

Gitbot git-noreply at pixie.qos.ch
Thu Nov 10 18:22:16 CET 2011


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, master has been updated
       via  c0d9b3b41b6cac04daa19d30f7a262ba81e8e319 (commit)
      from  2387e2336f34746d1b9cdda34fc43f5556d879f9 (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=c0d9b3b41b6cac04daa19d30f7a262ba81e8e319
http://github.com/ceki/logback/commit/c0d9b3b41b6cac04daa19d30f7a262ba81e8e319

commit c0d9b3b41b6cac04daa19d30f7a262ba81e8e319
Author: Ceki Gulcu <ceki at qos.ch>
Date:   Thu Nov 10 18:21:38 2011 +0100

    computeCurrentPeriodsHighestCounterValue() method should increment currentPeriodsCounter in case parent raw file==null and the file with the last index is compressed

diff --git a/logback-core/src/main/java/ch/qos/logback/core/rolling/SizeAndTimeBasedFNATP.java b/logback-core/src/main/java/ch/qos/logback/core/rolling/SizeAndTimeBasedFNATP.java
index bda2ad2..9b28199 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/rolling/SizeAndTimeBasedFNATP.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/rolling/SizeAndTimeBasedFNATP.java
@@ -17,6 +17,7 @@ import java.io.File;
 import java.util.Date;
 
 import ch.qos.logback.core.joran.spi.NoAutoStart;
+import ch.qos.logback.core.rolling.helper.CompressionMode;
 import ch.qos.logback.core.rolling.helper.FileFilterUtil;
 import ch.qos.logback.core.rolling.helper.SizeAndTimeBasedArchiveRemover;
 import ch.qos.logback.core.util.FileSize;
@@ -62,8 +63,19 @@ public class SizeAndTimeBasedFNATP<E> extends
       return;
     }
     currentPeriodsCounter = FileFilterUtil.findHighestCounter(matchingFileArray, stemRegex);
+
+
+    // if parent raw file property is not null, then the next
+    // counter is max  found counter+1
     if (tbrp.getParentsRawFileProperty() != null) {
       currentPeriodsCounter++;
+    } else if(tbrp.compressionMode != CompressionMode.NONE) {
+      // if raw file property == null, but compression is enabled
+      // we must check whether the last file whether the last file is
+      // compressed or not.
+      File fileCandidate = new File(getFileNameIncludingCompressionSuffix(dateInCurrentPeriod, currentPeriodsCounter));
+      if(fileCandidate.exists())
+        currentPeriodsCounter++;
     }
   }
 
@@ -105,6 +117,12 @@ public class SizeAndTimeBasedFNATP<E> extends
     return false;
   }
 
+  private String getFileNameIncludingCompressionSuffix(Date date, int counter) {
+    return tbrp.fileNamePattern.convertMultipleArguments(
+            dateInCurrentPeriod, counter);
+  }
+
+
   @Override
   public String getCurrentPeriodsFileNameWithoutCompressionSuffix() {
     return tbrp.fileNamePatternWCS.convertMultipleArguments(

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

Summary of changes:
 .../core/rolling/SizeAndTimeBasedFNATP.java        |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)


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


More information about the logback-dev mailing list