[logback-dev] [GIT] Logback: the generic, reliable, fast and flexible logging framework. branch, master, updated. v_0.9.29-18-gc65a762

added by portage for gitosis-gentoo git-noreply at pixie.qos.ch
Wed Aug 24 23:53:14 CEST 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  c65a76208681877c22de7a35c44dbade67919528 (commit)
      from  0ef4726a00390c62ef346ebfdd9673a8d4df4944 (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=c65a76208681877c22de7a35c44dbade67919528
http://github.com/ceki/logback/commit/c65a76208681877c22de7a35c44dbade67919528

commit c65a76208681877c22de7a35c44dbade67919528
Author: Ceki Gulcu <ceki at qos.ch>
Date:   Wed Aug 24 23:51:58 2011 +0200

    better implementation for extraFolder method in TimeBasedRollingWithArchiveRemovalTest

diff --git a/logback-core/src/test/java/ch/qos/logback/core/rolling/TimeBasedRollingWithArchiveRemovalTest.java b/logback-core/src/test/java/ch/qos/logback/core/rolling/TimeBasedRollingWithArchiveRemovalTest.java
index 5f06454..7f75422 100644
--- a/logback-core/src/test/java/ch/qos/logback/core/rolling/TimeBasedRollingWithArchiveRemovalTest.java
+++ b/logback-core/src/test/java/ch/qos/logback/core/rolling/TimeBasedRollingWithArchiveRemovalTest.java
@@ -29,10 +29,11 @@ import java.util.concurrent.TimeoutException;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-import ch.qos.logback.core.CoreConstants;
+import static ch.qos.logback.core.CoreConstants.DAILY_DATE_PATTERN;
 import ch.qos.logback.core.util.StatusPrinter;
 import org.junit.After;
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 
 import ch.qos.logback.core.Context;
@@ -106,6 +107,7 @@ public class TimeBasedRollingWithArchiveRemovalTest {
     System.out.println("randomOutputDir=" + randomOutputDir);
     // small maxHistory, many periods
     slashCount = computeSlashCount(MONTHLY_CROLOLOG_DATE_PATTERN);
+
     int numPeriods = 40;
     int maxHistory = 2;
 
@@ -113,15 +115,16 @@ public class TimeBasedRollingWithArchiveRemovalTest {
         + "}/clean.txt.zip", MILLIS_IN_MONTH, maxHistory, numPeriods);
     int beginPeriod = Calendar.getInstance().get(Calendar.MONTH);
     boolean extraFolder = extraFolder(numPeriods, 12, beginPeriod, maxHistory);
+    System.out.println("xxxx slashCount="+slashCount+", extraFolder="+extraFolder);
     StatusPrinter.print(context);
     check(expectedCountWithFolders(2, extraFolder));
   }
 
   @Test
   public void dailyRollover() throws Exception {
-    slashCount = computeSlashCount(CoreConstants.DAILY_DATE_PATTERN);
+    slashCount = computeSlashCount(DAILY_DATE_PATTERN);
     doRollover(
-        randomOutputDir + "clean-%d{" + CoreConstants.DAILY_DATE_PATTERN + "}.txt.zip",
+        randomOutputDir + "clean-%d{" + DAILY_DATE_PATTERN + "}.txt.zip",
         MILLIS_IN_DAY, 5, 5 * 3);
     check(expectedCountWithoutFolders(5));
   }
@@ -144,9 +147,9 @@ public class TimeBasedRollingWithArchiveRemovalTest {
     sizeAndTimeBasedFNATP.setMaxFileSize("10000");
     tbfnatp = sizeAndTimeBasedFNATP;
 
-    slashCount = computeSlashCount(CoreConstants.DAILY_DATE_PATTERN);
+    slashCount = computeSlashCount(DAILY_DATE_PATTERN);
     doRollover(
-        randomOutputDir + "/%d{" + CoreConstants.DAILY_DATE_PATTERN + "}-clean.%i.zip",
+        randomOutputDir + "/%d{" + DAILY_DATE_PATTERN + "}-clean.%i.zip",
         MILLIS_IN_DAY, 5, 5 * 4);
 
     // make .zip optional so that if for one reason or another, no size-based
@@ -165,7 +168,22 @@ public class TimeBasedRollingWithArchiveRemovalTest {
 
     slashCount = 1;
     doRollover(
-        randomOutputDir + "/%d{" + CoreConstants.DAILY_DATE_PATTERN + "}/clean.%i.zip",
+        randomOutputDir + "/%d{" + DAILY_DATE_PATTERN + "}/clean.%i.zip",
+        MILLIS_IN_DAY, 5, 5 * 4);
+    checkDirPatternCompliance(6);
+  }
+
+
+  @Ignore
+  @Test
+  public void dailyChronologSizeBasedRolloverWhenLogFilenameDoesNotContainDirectory() throws Exception {
+    SizeAndTimeBasedFNATP<Object> sizeAndTimeBasedFNATP = new SizeAndTimeBasedFNATP<Object>();
+    sizeAndTimeBasedFNATP.setMaxFileSize("10000");
+    tbfnatp = sizeAndTimeBasedFNATP;
+
+    slashCount = 1;
+    doRollover(
+        "clean.%d{" + DAILY_DATE_PATTERN + "}.%i.zip",
         MILLIS_IN_DAY, 5, 5 * 4);
     checkDirPatternCompliance(6);
   }
@@ -294,9 +312,9 @@ public class TimeBasedRollingWithArchiveRemovalTest {
   // year is 2012, and not 2013 (the current year).
   boolean extraFolder(int numPeriods, int periodsPerEra, int beginPeriod,
       int maxHistory) {
-    int adjustedBegin = beginPeriod + 1;
-    int remainder = ((adjustedBegin) + numPeriods) % periodsPerEra;
-    return (remainder < maxHistory + 1);
+    // beginPeriod is 0 for JAN, 1 for FEB etc
+    int valueOfLastMonth = ((beginPeriod) + numPeriods) % periodsPerEra;
+    return (valueOfLastMonth < maxHistory);
   }
 
   int expectedCountWithFolders(int maxHistory, boolean extraFolder) {

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

Summary of changes:
 .../TimeBasedRollingWithArchiveRemovalTest.java    |   36 +++++++++++++++-----
 1 files changed, 27 insertions(+), 9 deletions(-)


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


More information about the logback-dev mailing list