[logback-dev] branch, master, updated. f0a9057c4c1574160f31fb8f173636602d5d0b3a

added by portage for gitosis-gentoo git-noreply at pixie.qos.ch
Sat Sep 19 17:59:50 CEST 2009


The branch, master has been updated
       via  f0a9057c4c1574160f31fb8f173636602d5d0b3a (commit)
      from  0900ca3cdd75ee9a5bbbdfc92cc02997a4ddbaa8 (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=f0a9057c4c1574160f31fb8f173636602d5d0b3a
http://github.com/ceki/logback/commit/f0a9057c4c1574160f31fb8f173636602d5d0b3a

commit f0a9057c4c1574160f31fb8f173636602d5d0b3a
Author: Ceki Gulcu <ceki at qos.ch>
Date:   Sat Sep 19 17:54:39 2009 +0200

    - corrected the expected line number in ConverterTest
    - fixed TimeBasedRollingWithArchiveRemovalTest.java which would fail when the
      number of period+currentMonth - maxHistory is placed in the previous year.
    - minor editing in license.html

diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/pattern/ConverterTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/pattern/ConverterTest.java
index bfa1536..c1ff3b5 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/pattern/ConverterTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/pattern/ConverterTest.java
@@ -74,7 +74,7 @@ public class ConverterTest {
       StringBuffer buf = new StringBuffer();
       converter.write(buf, le);
       // the number below should be the line number of the previous line
-      assertEquals("76", buf.toString());
+      assertEquals("75", buf.toString());
     }
   }
 
diff --git a/logback-core/src/main/java/ch/qos/logback/core/sift/AppenderTrackerImpl.java b/logback-core/src/main/java/ch/qos/logback/core/sift/AppenderTrackerImpl.java
index 1bc86b2..20cc37c 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/sift/AppenderTrackerImpl.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/sift/AppenderTrackerImpl.java
@@ -165,9 +165,9 @@ public class AppenderTrackerImpl<E> implements AppenderTracker<E> {
       this.timestamp = timestamp;
     }
 
-    public long getTimestamp() {
-      return timestamp;
-    }
+//    public long getTimestamp() {
+//      return timestamp;
+//    }
 
     public void setTimestamp(long timestamp) {
       this.timestamp = timestamp;
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 20b4f90..af4a068 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
@@ -18,6 +18,7 @@ import static org.junit.Assert.assertTrue;
 import java.io.File;
 import java.io.FileFilter;
 import java.util.ArrayList;
+import java.util.Calendar;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
@@ -93,16 +94,22 @@ public class TimeBasedRollingWithArchiveRemovalTest {
     // large maxPeriod, a 3 times as many number of periods to simulate
     doRollover(randomOutputDir + "clean-%d{" + MONTHLY_DATE_PATTERN + "}.txt",
         MILLIS_IN_MONTH, 20, 20 * 3);
-    check(expectedCountWithoutDirs(20));
+    check(expectedCountWithoutFolders(20));
   }
 
   @Test
   public void montlyRolloverOverManyPeriods() throws Exception {
+    System.out.println("randomOutputDir=" + randomOutputDir);
     // small maxHistory, many periods
     slashCount = computeSlashCount(MONTHLY_CROLOLOG_DATE_PATTERN);
+    int numPeriods = 40;
+    int maxHistory = 2;
+    
     doRollover(randomOutputDir + "/%d{" + MONTHLY_CROLOLOG_DATE_PATTERN
-        + "}/clean.txt.zip", MILLIS_IN_MONTH, 2, 40);
-    check(expectedCountWithDirs(2));
+        + "}/clean.txt.zip", MILLIS_IN_MONTH, maxHistory, numPeriods);
+    int beginPeriod = Calendar.getInstance().get(Calendar.MONTH);
+    boolean extraFolder = extraFolder(numPeriods, 12, beginPeriod, maxHistory);
+    check(expectedCountWithFolders(2, extraFolder));
   }
 
   @Test
@@ -111,7 +118,7 @@ public class TimeBasedRollingWithArchiveRemovalTest {
     doRollover(
         randomOutputDir + "clean-%d{" + DAILY_DATE_PATTERN + "}.txt.zip",
         MILLIS_IN_DAY, 5, 5 * 3);
-    check(expectedCountWithoutDirs(5));
+    check(expectedCountWithoutFolders(5));
   }
 
   @Test
@@ -121,8 +128,8 @@ public class TimeBasedRollingWithArchiveRemovalTest {
         + "}/clean.txt.zip", MILLIS_IN_DAY, 8, 8 * 3);
     int expectedDirMin = 9 + slashCount;
     int expectDirMax = expectedDirMin + 1 + 1; // plus 1 of stepping into a
-                                                // new month, and another 1 into
-                                                // a new year
+    // new month, and another 1 into
+    // a new year
     expectedFileAndDirCount(9, expectedDirMin, expectDirMax);
   }
 
@@ -253,15 +260,29 @@ public class TimeBasedRollingWithArchiveRemovalTest {
     }
   }
 
-  int expectedCountWithoutDirs(int maxHistory) {
+  int expectedCountWithoutFolders(int maxHistory) {
     // maxHistory plus the currently active file
     return maxHistory + 1;
   }
 
-  int expectedCountWithDirs(int maxHistory) {
+  // sometimes, after a number of periods, there is an extra folder
+  // from the previous "era" because the latest period - maxHistory, enters the
+  // bound of the previous era. For example, with a maxHistory of 2, on 2009-09,
+  // after 40 periods, the current period is 2013-01. Going back two months, the
+  // year is 2012, and not 2013 (the current year).
+  boolean extraFolder(int numPeriods, int periodsPerEra, int beginPeriod,
+      int maxHistory) {
+    int remainder = (beginPeriod + numPeriods) % periodsPerEra;
+    return (remainder < maxHistory + 1);
+  }
+
+  int expectedCountWithFolders(int maxHistory, boolean extraFolder) {
     // each slash adds a new directory
     // + one file and one directory per archived log file
-    return (maxHistory + 1) * 2 + slashCount;
+    int result = (maxHistory + 1) * 2 + slashCount;
+    if (extraFolder)
+      result++;
+    return result;
   }
 
   void check(int expectedCount) {
diff --git a/logback-site/src/site/pages/license.html b/logback-site/src/site/pages/license.html
index 3220c12..0bc88a2 100644
--- a/logback-site/src/site/pages/license.html
+++ b/logback-site/src/site/pages/license.html
@@ -59,7 +59,7 @@ as published by the Free Software Foundation.</p>
     </p>
 
     <p>On the other hand, the EPL license will placate organizations
-    which refuse the various restrictions imposed by the LGPL.
+    which refuse certain restrictions imposed by the LGPL.
     </p>
     
     <p>If you wish to make a significant contribution to the logback

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

Summary of changes:
 .../qos/logback/classic/pattern/ConverterTest.java |    2 +-
 .../qos/logback/core/sift/AppenderTrackerImpl.java |    6 ++--
 .../TimeBasedRollingWithArchiveRemovalTest.java    |   39 +++++++++++++++-----
 logback-site/src/site/pages/license.html           |    2 +-
 4 files changed, 35 insertions(+), 14 deletions(-)


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


More information about the logback-dev mailing list