[logback-dev] [GIT] Logback: the generic, reliable, fast and flexible logging framework. branch master updated. v_1.0.1-26-gd886e9b

Gitbot git-noreply at pixie.qos.ch
Tue Apr 24 19:55:59 CEST 2012


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  d886e9b0aa31036bf5bf5c5b78249afb50a80d6c (commit)
      from  560596f736cc1bf37171bd4d5d19dfc96a625550 (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=d886e9b0aa31036bf5bf5c5b78249afb50a80d6c
http://github.com/ceki/logback/commit/d886e9b0aa31036bf5bf5c5b78249afb50a80d6c

commit d886e9b0aa31036bf5bf5c5b78249afb50a80d6c
Author: Ceki Gulcu <ceki at qos.ch>
Date:   Tue Apr 24 19:50:59 2012 +0200

    fix LBCORE-169

diff --git a/logback-core/src/main/java/ch/qos/logback/core/rolling/TimeBasedFileNamingAndTriggeringPolicyBase.java b/logback-core/src/main/java/ch/qos/logback/core/rolling/TimeBasedFileNamingAndTriggeringPolicyBase.java
index b5a05da..69d8b42 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/rolling/TimeBasedFileNamingAndTriggeringPolicyBase.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/rolling/TimeBasedFileNamingAndTriggeringPolicyBase.java
@@ -55,7 +55,6 @@ abstract public class TimeBasedFileNamingAndTriggeringPolicyBase<E> extends
             + "'.");
     rc.printPeriodicity(this);
 
-
     setDateInCurrentPeriod(new Date(getCurrentTime()));
     if (tbrp.getParentsRawFileProperty() != null) {
       File currentFile = new File(tbrp.getParentsRawFileProperty());
diff --git a/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/Compressor.java b/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/Compressor.java
index 0132322..5e139e1 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/Compressor.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/rolling/helper/Compressor.java
@@ -22,14 +22,16 @@ import java.util.zip.GZIPOutputStream;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipOutputStream;
 
+import ch.qos.logback.core.rolling.RolloverFailure;
 import ch.qos.logback.core.spi.ContextAwareBase;
 import ch.qos.logback.core.status.ErrorStatus;
 import ch.qos.logback.core.status.WarnStatus;
+import ch.qos.logback.core.util.FileUtil;
 
 /**
  * The <code>Compression</code> class implements ZIP and GZ file
  * compression/decompression methods.
- * 
+ *
  * @author Ceki Gülcü
  */
 public class Compressor extends ContextAwareBase {
@@ -40,25 +42,22 @@ public class Compressor extends ContextAwareBase {
     this.compressionMode = compressionMode;
   }
 
-    /**
-     *
-     * @param nameOfFile2Compress
-     * @param nameOfCompressedFile
-     * @param innerEntryName The name of the file within the zip file. Use for ZIP compression.
-     */
+  /**
+   * @param nameOfFile2Compress
+   * @param nameOfCompressedFile
+   * @param innerEntryName       The name of the file within the zip file. Use for ZIP compression.
+   */
   public void compress(String nameOfFile2Compress, String nameOfCompressedFile, String innerEntryName) {
     switch (compressionMode) {
-    case GZ:
-      addInfo("GZ compressing [" + nameOfFile2Compress + "].");
-      gzCompress(nameOfFile2Compress, nameOfCompressedFile);
-      break;
-    case ZIP:
-      addInfo("ZIP compressing [" + nameOfFile2Compress + "].");
-      zipCompress(nameOfFile2Compress, nameOfCompressedFile, innerEntryName);
-      break;
-    case NONE:
-      throw new UnsupportedOperationException(
-          "compress method called in NONE compression mode");
+      case GZ:
+        gzCompress(nameOfFile2Compress, nameOfCompressedFile);
+        break;
+      case ZIP:
+        zipCompress(nameOfFile2Compress, nameOfCompressedFile, innerEntryName);
+        break;
+      case NONE:
+        throw new UnsupportedOperationException(
+                "compress method called in NONE compression mode");
     }
   }
 
@@ -67,12 +66,12 @@ public class Compressor extends ContextAwareBase {
 
     if (!file2zip.exists()) {
       addStatus(new WarnStatus("The file to compress named [" + nameOfFile2zip
-          + "] does not exist.", this));
+              + "] does not exist.", this));
 
       return;
     }
 
-    if(innerEntryName == null) {
+    if (innerEntryName == null) {
       addStatus(new WarnStatus("The innerEntryName parameter cannot be null", this));
       return;
     }
@@ -85,11 +84,14 @@ public class Compressor extends ContextAwareBase {
 
     if (zippedFile.exists()) {
       addStatus(new WarnStatus("The target compressed file named ["
-          + nameOfZippedFile + "] exist already.", this));
+              + nameOfZippedFile + "] exist already.", this));
 
       return;
     }
 
+    addInfo("ZIP compressing [" + file2zip + "] as ["+zippedFile+"]");
+    createMissingTargetDirsIfNecessary(zippedFile);
+
     BufferedInputStream bis = null;
     ZipOutputStream zos = null;
     try {
@@ -113,20 +115,20 @@ public class Compressor extends ContextAwareBase {
 
       if (!file2zip.delete()) {
         addStatus(new WarnStatus("Could not delete [" + nameOfFile2zip + "].",
-            this));
+                this));
       }
     } catch (Exception e) {
       addStatus(new ErrorStatus("Error occurred while compressing ["
-          + nameOfFile2zip + "] into [" + nameOfZippedFile + "].", this, e));
+              + nameOfFile2zip + "] into [" + nameOfZippedFile + "].", this, e));
     } finally {
-      if(bis != null) {
+      if (bis != null) {
         try {
           bis.close();
         } catch (IOException e) {
           // ignore
         }
       }
-      if(zos != null) {
+      if (zos != null) {
         try {
           zos.close();
         } catch (IOException e) {
@@ -168,11 +170,12 @@ public class Compressor extends ContextAwareBase {
 
     if (!file2gz.exists()) {
       addStatus(new WarnStatus("The file to compress named [" + nameOfFile2gz
-          + "] does not exist.", this));
+              + "] does not exist.", this));
 
       return;
     }
 
+
     if (!nameOfgzedFile.endsWith(".gz")) {
       nameOfgzedFile = nameOfgzedFile + ".gz";
     }
@@ -180,12 +183,14 @@ public class Compressor extends ContextAwareBase {
     File gzedFile = new File(nameOfgzedFile);
 
     if (gzedFile.exists()) {
-      addStatus(new WarnStatus("The target compressed file named ["
-          + nameOfgzedFile + "] exist already.", this));
-
+      addWarn("The target compressed file named ["
+              + nameOfgzedFile + "] exist already. Aborting file compression.");
       return;
     }
 
+    addInfo("GZ compressing [" + file2gz + "] as ["+gzedFile+"]");
+    createMissingTargetDirsIfNecessary(gzedFile);
+
     BufferedInputStream bis = null;
     GZIPOutputStream gzos = null;
     try {
@@ -205,20 +210,20 @@ public class Compressor extends ContextAwareBase {
 
       if (!file2gz.delete()) {
         addStatus(new WarnStatus("Could not delete [" + nameOfFile2gz + "].",
-            this));
+                this));
       }
     } catch (Exception e) {
       addStatus(new ErrorStatus("Error occurred while compressing ["
-          + nameOfFile2gz + "] into [" + nameOfgzedFile + "].", this, e));
+              + nameOfFile2gz + "] into [" + nameOfgzedFile + "].", this, e));
     } finally {
-      if(bis != null) {
+      if (bis != null) {
         try {
           bis.close();
         } catch (IOException e) {
           // ignore
         }
       }
-      if(gzos != null) {
+      if (gzos != null) {
         try {
           gzos.close();
         } catch (IOException e) {
@@ -233,24 +238,38 @@ public class Compressor extends ContextAwareBase {
     int len = fileNamePatternStr.length();
     switch (compressionMode) {
       case GZ:
-    	  if(fileNamePatternStr.endsWith(".gz")) 
-            return fileNamePatternStr.substring(0, len - 3);
-    	  else 
-    		 return fileNamePatternStr;
+        if (fileNamePatternStr.endsWith(".gz"))
+          return fileNamePatternStr.substring(0, len - 3);
+        else
+          return fileNamePatternStr;
       case ZIP:
-    	  if(fileNamePatternStr.endsWith(".zip")) 
-    	  return fileNamePatternStr.substring(0, len - 4);
-    	  else 
-    		return fileNamePatternStr;	  
+        if (fileNamePatternStr.endsWith(".zip"))
+          return fileNamePatternStr.substring(0, len - 4);
+        else
+          return fileNamePatternStr;
       case NONE:
         return fileNamePatternStr;
     }
     throw new IllegalStateException("Execution should not reach this point");
   }
 
+
+  void createMissingTargetDirsIfNecessary(File file) {
+    if (FileUtil.isParentDirectoryCreationRequired(file)) {
+      boolean result = FileUtil.createMissingParentDirectories(file);
+      if (!result) {
+        addError("Failed to create parent directories for ["
+                + file.getAbsolutePath() + "]");
+      } else {
+        addInfo("Created missing parent directories for ["
+                + file.getAbsolutePath() + "]");
+      }
+    }
+  }
+
   @Override
   public String toString() {
-    return "c.q.l.core.rolling.helper.Compress";
+    return this.getClass().getName();
   }
 
 }
diff --git a/logback-core/src/test/java/ch/qos/logback/core/util/Compare.java b/logback-core/src/test/java/ch/qos/logback/core/util/Compare.java
index 536c1ba..1f21128 100644
--- a/logback-core/src/test/java/ch/qos/logback/core/util/Compare.java
+++ b/logback-core/src/test/java/ch/qos/logback/core/util/Compare.java
@@ -19,7 +19,11 @@ import java.io.FileNotFoundException;
 import java.io.FileReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
+import java.util.Enumeration;
 import java.util.zip.GZIPInputStream;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+import java.util.zip.ZipInputStream;
 
 public class Compare {
   static final int B1_NULL = -1;
@@ -27,8 +31,9 @@ public class Compare {
 
   public static boolean compare(String file1, String file2) throws FileNotFoundException, IOException {
     if (file1.endsWith(".gz")) {
-      //System.out.println(file1 +" is a gz file");
       return gzFileCompare(file1, file2);
+    } else if(file1.endsWith(".zip")) {
+      return zipFileCompare(file1, file2);
     } else {
       return regularFileCompare(file1, file2);
     }
@@ -39,13 +44,24 @@ public class Compare {
     GZIPInputStream gzis = new GZIPInputStream(fis);
     return new BufferedReader(new InputStreamReader(gzis));
   }
-  
+
+  static BufferedReader zipFileToBufferedReader(String file) throws IOException {
+    FileInputStream fis = new FileInputStream(file);
+    ZipInputStream zis = new  ZipInputStream(fis);
+    zis.getNextEntry();
+    return new BufferedReader(new InputStreamReader(zis));
+  }
   public static boolean gzFileCompare(String file1, String file2) throws IOException {
     BufferedReader in1 = gzFileToBufferedReader(file1);
     BufferedReader in2 = gzFileToBufferedReader(file2);
     return bufferCompare(in1, in2, file1, file2);
   }
 
+  public static boolean zipFileCompare(String file1, String file2) throws IOException {
+    BufferedReader in1 = zipFileToBufferedReader(file1);
+    BufferedReader in2 = zipFileToBufferedReader(file2);
+    return bufferCompare(in1, in2, file1, file2);
+  }
   public static boolean regularFileCompare(String file1, String file2)
       throws FileNotFoundException, IOException {
     BufferedReader in1 = new BufferedReader(new FileReader(file1));
diff --git a/logback-core/src/test/scala/ch/qos/logback/core/rolling/RollingScaffolding.scala b/logback-core/src/test/scala/ch/qos/logback/core/rolling/RollingScaffolding.scala
index b88b50b..0f54d19 100644
--- a/logback-core/src/test/scala/ch/qos/logback/core/rolling/RollingScaffolding.scala
+++ b/logback-core/src/test/scala/ch/qos/logback/core/rolling/RollingScaffolding.scala
@@ -6,7 +6,7 @@
  * either the terms of the Eclipse Public License v1.0 as published by
  * the Eclipse Foundation
  *
- *   or (per the licensee's choosing)
+ * or (per the licensee's choosing)
  *
  * under the terms of the GNU Lesser General Public License version 2.1
  * as published by the Free Software Foundation.
@@ -14,7 +14,7 @@
 package ch.qos.logback.core.rolling
 
 import ch.qos.logback.core.{ContextBase, Context}
-import helper.FileFilterUtil
+import helper.{FileNamePattern, FileFilterUtil}
 import java.util.concurrent.TimeUnit
 import ch.qos.logback.core.util.{CachingDateFormatter, CoreTestConstants}
 import org.junit.Assert._
@@ -29,7 +29,7 @@ trait RollingScaffolding {
 
   val context: Context = new ContextBase
   val sm = context.getStatusManager()
-  
+
   var diff: Int = RandomUtil.getPositiveInt
 
   protected var currentTime: Long = 0L
@@ -63,24 +63,23 @@ trait RollingScaffolding {
     return new Date(currentTime - delta)
   }
 
-  protected def addExpectedFileName_ByDate(outputDir: String, testId: String, millis: Long, gzExtension: Boolean): Unit = {
-    var fn: String = outputDir + testId + "-" + SDF.format(millis)
-    if (gzExtension) {
-      fn += ".gz"
-    }
+  protected def addExpectedFileName_ByDate(patternStr: String, millis: Long): Unit = {
+    val fileNamePattern = new FileNamePattern(patternStr, context)
+    var fn: String = fileNamePattern.convert(new Date(millis))
+    println("fn=" + fn)
     expectedFilenameList = expectedFilenameList ::: List(fn)
 
   }
 
   protected def addExpectedFileName_ByFileIndexCounter(randomOutputDir: String, testId: String, millis: Long, fileIndexCounter: Int, compressionSuffix: String): Unit = {
-    var fn: String = randomOutputDir + testId + "-" + SDF.format(millis) + "-" + fileIndexCounter + ".txt"+compressionSuffix
+    var fn: String = randomOutputDir + testId + "-" + SDF.format(millis) + "-" + fileIndexCounter + ".txt" + compressionSuffix
     expectedFilenameList = expectedFilenameList ::: List(fn)
   }
 
-    
-  protected def addExpectedFileNamedIfItsTime_ByDate(outputDir: String, testId: String, gzExtension: Boolean): Unit = {
+
+  protected def addExpectedFileNamedIfItsTime_ByDate(fileNamePatternStr: String): Unit = {
     if (passThresholdTime(nextRolloverThreshold)) {
-      addExpectedFileName_ByDate(outputDir, testId, getMillisOfCurrentPeriodsStart, gzExtension)
+      addExpectedFileName_ByDate(fileNamePatternStr, getMillisOfCurrentPeriodsStart)
       recomputeRolloverThreshold(currentTime)
     }
   }
@@ -112,9 +111,16 @@ trait RollingScaffolding {
   // =========================================================================
   // utility methods
   // =========================================================================
-  private[rolling] def massageExpectedFilesToCorresponToCurrentTarget(file: String): Unit = {
+  private[rolling] def massageExpectedFilesToCorresponToCurrentTarget(file: String, fileOptionIsSet: Boolean): Unit = {
+    val last: String = expectedFilenameList.last
     expectedFilenameList = expectedFilenameList.dropRight(1)
-    expectedFilenameList = expectedFilenameList ::: List(file) 
+
+    if (fileOptionIsSet) {
+      expectedFilenameList = expectedFilenameList ::: List(file)
+    } else if (last.endsWith(".gz")) {
+      val stem = last.dropRight(3)
+      expectedFilenameList = expectedFilenameList ::: List(stem)
+    }
   }
 
   def existenceCheck(filenameList: List[String]): Unit = {
@@ -133,7 +139,7 @@ trait RollingScaffolding {
     FileFilterUtil.sortFileArrayByName(fileArray)
     fileContentCheck(fileArray, runLength, prefix)
   }
-   
+
   def reverseSortedContentCheck(outputDirStr: String, runLength: Int, prefix: String) {
     var fileArray: Array[File] = getFilesInDirectory(outputDirStr)
     FileFilterUtil.reverseSortFileArrayByName(fileArray)
diff --git a/logback-core/src/test/scala/ch/qos/logback/core/rolling/SizeAndTimeBasedFNATP_STest.scala b/logback-core/src/test/scala/ch/qos/logback/core/rolling/SizeAndTimeBasedFNATP_STest.scala
index 370323f..00caf98 100644
--- a/logback-core/src/test/scala/ch/qos/logback/core/rolling/SizeAndTimeBasedFNATP_STest.scala
+++ b/logback-core/src/test/scala/ch/qos/logback/core/rolling/SizeAndTimeBasedFNATP_STest.scala
@@ -106,9 +106,9 @@ class SizeAndTimeBasedFNATP_STest extends RollingScaffolding {
       secondPhase
       runLength = runLength*2
     }
-    
+
     if (stem != null)
-      massageExpectedFilesToCorresponToCurrentTarget(file)
+      massageExpectedFilesToCorresponToCurrentTarget(file, true)
 
     Thread.sleep(20)
     // wait for compression to finish
diff --git a/logback-core/src/test/scala/ch/qos/logback/core/rolling/TimeBasedRolling_STest.scala b/logback-core/src/test/scala/ch/qos/logback/core/rolling/TimeBasedRolling_STest.scala
index c2d8aa4..ce09a22 100644
--- a/logback-core/src/test/scala/ch/qos/logback/core/rolling/TimeBasedRolling_STest.scala
+++ b/logback-core/src/test/scala/ch/qos/logback/core/rolling/TimeBasedRolling_STest.scala
@@ -57,23 +57,24 @@ class TimeBasedRolling_STest extends RollingScaffolding {
   }
 
   type CheckFunction = ((String, Boolean, String) => Unit)
-  def genericTest(checkFunction: CheckFunction)(testId: String, compressionSuffix: String, fileOptionIsSet: Boolean, waitDuration: Int): Unit = {
+  def genericTest(checkFunction: CheckFunction)(testId: String, patternPrefix: String, compressionSuffix: String, fileOptionIsSet: Boolean, waitDuration: Int): Unit = {
     val withCompression = compressionSuffix.length > 0
     val fileName = if (fileOptionIsSet) testId2FileName(testId) else null;
     initRFA(rfa1, fileName);
 
-    initTRBP(rfa1, tbrp1, randomOutputDir + testId + "-%d{"
-      + DATE_PATTERN_WITH_SECONDS + "}" + compressionSuffix, currentTime);
+    val fileNamePatternStr = randomOutputDir + patternPrefix + "-%d{"+ DATE_PATTERN_WITH_SECONDS + "}"+compressionSuffix
+
+    initTRBP(rfa1, tbrp1, fileNamePatternStr, currentTime);
 
     // compute the current filename
-    addExpectedFileName_ByDate(randomOutputDir, testId, getMillisOfCurrentPeriodsStart, withCompression);
+    addExpectedFileName_ByDate(fileNamePatternStr, getMillisOfCurrentPeriodsStart);
 
     incCurrentTime(1100);
     tbrp1.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime);
 
     for (i <- 0 until 3) {
       rfa1.doAppend("Hello---" + i);
-      addExpectedFileNamedIfItsTime_ByDate(randomOutputDir, testId, withCompression && (i != 2))
+      addExpectedFileNamedIfItsTime_ByDate(fileNamePatternStr) //, withCompression && (i != 2))
       incCurrentTime(500);
       tbrp1.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime)
       if (withCompression)
@@ -82,13 +83,12 @@ class TimeBasedRolling_STest extends RollingScaffolding {
     rfa1.stop
 
     if (waitDuration != NO_RESTART) {
-      doRestart(testId, fileOptionIsSet, waitDuration);
+      doRestart(testId, patternPrefix, fileOptionIsSet, waitDuration);
     }
 
-    if (fileOptionIsSet) {
-      massageExpectedFilesToCorresponToCurrentTarget(fileName)
-    }
+    massageExpectedFilesToCorresponToCurrentTarget(fileName, fileOptionIsSet)
 
+    StatusPrinter.print(context)
     checkFunction(testId, withCompression, compressionSuffix)
   }
 
@@ -114,19 +114,21 @@ class TimeBasedRolling_STest extends RollingScaffolding {
 
 
 
-  def doRestart(testId: String, fileOptionIsSet: Boolean, waitDuration: Int) {
+  def doRestart(testId: String, patternPart: String, fileOptionIsSet: Boolean, waitDuration: Int) {
     // change the timestamp of the currently actively file
     var activeFile: File = new File(rfa1.getFile)
     activeFile.setLastModified(currentTime)
 
     incCurrentTime(waitDuration)
 
+    val filePatternStr = randomOutputDir + patternPart + "-%d{" + DATE_PATTERN_WITH_SECONDS + "}"
+
     val fileName = if (fileOptionIsSet) testId2FileName(testId) else null;
     initRFA(rfa2, fileName)
-    initTRBP(rfa2, tbrp2, randomOutputDir + testId + "-%d{" + DATE_PATTERN_WITH_SECONDS + "}", currentTime)
+    initTRBP(rfa2, tbrp2, filePatternStr, currentTime)
     for (i <- 0 until 3) {
       rfa2.doAppend("World---" + i)
-      addExpectedFileNamedIfItsTime_ByDate(randomOutputDir, testId, false)
+      addExpectedFileNamedIfItsTime_ByDate(filePatternStr)
       incCurrentTime(100)
       tbrp2.timeBasedFileNamingAndTriggeringPolicy.setCurrentTime(currentTime)
     }
@@ -138,44 +140,49 @@ class TimeBasedRolling_STest extends RollingScaffolding {
 
   @Test
   def noCompression_FileBlank_NoRestart_1 = {
-    defaultTest("test1", "", FILE_OPTION_BLANK, NO_RESTART)
+    defaultTest("test1", "test1", "", FILE_OPTION_BLANK, NO_RESTART)
   }
 
   @Test
   def withCompression_FileBlank_NoRestart_2 = {
-    defaultTest("test2", ".gz", FILE_OPTION_BLANK, NO_RESTART);
+    defaultTest("test2", "test2", ".gz", FILE_OPTION_BLANK, NO_RESTART);
   }
 
   @Test
   def noCompression_FileBlank_StopRestart_3 = {
-    defaultTest("test3", "", FILE_OPTION_BLANK, WITH_RESTART);
+    defaultTest("test3", "test3", "", FILE_OPTION_BLANK, WITH_RESTART);
   }
 
   @Test
   def noCompression_FileSet_StopRestart_4 = {
-    defaultTest("test4", "", FILE_OPTION_SET, WITH_RESTART);
+    defaultTest("test4", "test4", "", FILE_OPTION_SET, WITH_RESTART);
   }
 
   @Test
   def noCompression_FileSet_StopRestart_WithLongWait_4B = {
-    defaultTest("test4B", "", FILE_OPTION_SET, WITH_RESTART_AND_LONG_WAIT);
+    defaultTest("test4B", "test4B", "", FILE_OPTION_SET, WITH_RESTART_AND_LONG_WAIT);
   }
 
   @Test
   def noCompression_FileSet_NoRestart_5 = {
-    defaultTest("test5", "", FILE_OPTION_SET, NO_RESTART);
+    defaultTest("test5", "test6", "", FILE_OPTION_SET, NO_RESTART);
   }
 
   @Test
   def withCompression_FileSet_NoRestart_6 = {
-    defaultTest("test6", ".gz", FILE_OPTION_SET, NO_RESTART);
+    defaultTest("test6", "test6", ".gz", FILE_OPTION_SET, NO_RESTART);
   }
 
+  // LBCORE-169
   @Test
-  def withMissingTargetDir = {
-    defaultTest("missingTargetDir", "", FILE_OPTION_SET, NO_RESTART);
+  def withMissingTargetDirWithCompression = {
+    defaultTest("test7", "%d{yyyy-MM-dd, aux}/", ".gz", FILE_OPTION_SET, NO_RESTART);
   }
 
+  @Test
+  def withMissingTargetDirWithZipCompression = {
+    defaultTest("test8", "%d{yyyy-MM-dd, aux}/", ".zip", FILE_OPTION_SET, NO_RESTART);
+  }
 
   @Test
   def failed_rename: Unit = {
@@ -188,7 +195,7 @@ class TimeBasedRolling_STest extends RollingScaffolding {
       file.getParentFile.mkdirs
 
       fos = new FileOutputStream(fileName)
-      genericTest(zCheck)("failed_rename", "", FILE_OPTION_SET, NO_RESTART)
+      genericTest(zCheck)("failed_rename", "failed_rename", "", FILE_OPTION_SET, NO_RESTART)
 
     } finally {
       StatusPrinter.print(context)
diff --git a/logback-core/src/test/witness/rolling/tbr-missingTargetDir.0 b/logback-core/src/test/witness/rolling/tbr-missingTargetDir.0
deleted file mode 100644
index e69de29..0000000
diff --git a/logback-core/src/test/witness/rolling/tbr-missingTargetDir.1 b/logback-core/src/test/witness/rolling/tbr-missingTargetDir.1
deleted file mode 100644
index aea23e8..0000000
--- a/logback-core/src/test/witness/rolling/tbr-missingTargetDir.1
+++ /dev/null
@@ -1,2 +0,0 @@
-Hello---0
-Hello---1
\ No newline at end of file
diff --git a/logback-core/src/test/witness/rolling/tbr-test7.0.gz b/logback-core/src/test/witness/rolling/tbr-test7.0.gz
new file mode 100644
index 0000000..001322f
Binary files /dev/null and b/logback-core/src/test/witness/rolling/tbr-test7.0.gz differ
diff --git a/logback-core/src/test/witness/rolling/tbr-test7.1.gz b/logback-core/src/test/witness/rolling/tbr-test7.1.gz
new file mode 100644
index 0000000..1a80ee1
Binary files /dev/null and b/logback-core/src/test/witness/rolling/tbr-test7.1.gz differ
diff --git a/logback-core/src/test/witness/rolling/tbr-missingTargetDir.2 b/logback-core/src/test/witness/rolling/tbr-test7.2
similarity index 100%
copy from logback-core/src/test/witness/rolling/tbr-missingTargetDir.2
copy to logback-core/src/test/witness/rolling/tbr-test7.2
diff --git a/logback-core/src/test/witness/rolling/tbr-test8.0.zip b/logback-core/src/test/witness/rolling/tbr-test8.0.zip
new file mode 100644
index 0000000..0191c2a
Binary files /dev/null and b/logback-core/src/test/witness/rolling/tbr-test8.0.zip differ
diff --git a/logback-core/src/test/witness/rolling/tbr-test8.1.zip b/logback-core/src/test/witness/rolling/tbr-test8.1.zip
new file mode 100644
index 0000000..621f821
Binary files /dev/null and b/logback-core/src/test/witness/rolling/tbr-test8.1.zip differ
diff --git a/logback-core/src/test/witness/rolling/tbr-missingTargetDir.2 b/logback-core/src/test/witness/rolling/tbr-test8.2
similarity index 100%
rename from logback-core/src/test/witness/rolling/tbr-missingTargetDir.2
rename to logback-core/src/test/witness/rolling/tbr-test8.2

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

Summary of changes:
 ...TimeBasedFileNamingAndTriggeringPolicyBase.java |    1 -
 .../logback/core/rolling/helper/Compressor.java    |  103 ++++++++++++--------
 .../java/ch/qos/logback/core/util/Compare.java     |   20 ++++-
 .../logback/core/rolling/RollingScaffolding.scala  |   36 ++++---
 .../core/rolling/SizeAndTimeBasedFNATP_STest.scala |    4 +-
 .../core/rolling/TimeBasedRolling_STest.scala      |   51 ++++++----
 .../test/witness/rolling/tbr-missingTargetDir.1    |    2 -
 .../rolling/{tbr-test2.0.gz => tbr-test7.0.gz}     |  Bin 20 -> 20 bytes
 .../src/test/witness/rolling/tbr-test7.1.gz        |  Bin 0 -> 36 bytes
 .../{tbr-missingTargetDir.2 => tbr-test7.2}        |    0
 .../src/test/witness/rolling/tbr-test8.0.zip       |  Bin 0 -> 156 bytes
 .../src/test/witness/rolling/tbr-test8.1.zip       |  Bin 0 -> 172 bytes
 .../{tbr-missingTargetDir.2 => tbr-test8.2}        |    0
 13 files changed, 131 insertions(+), 86 deletions(-)
 delete mode 100644 logback-core/src/test/witness/rolling/tbr-missingTargetDir.0
 delete mode 100644 logback-core/src/test/witness/rolling/tbr-missingTargetDir.1
 copy logback-core/src/test/witness/rolling/{tbr-test2.0.gz => tbr-test7.0.gz} (100%)
 create mode 100644 logback-core/src/test/witness/rolling/tbr-test7.1.gz
 copy logback-core/src/test/witness/rolling/{tbr-missingTargetDir.2 => tbr-test7.2} (100%)
 create mode 100644 logback-core/src/test/witness/rolling/tbr-test8.0.zip
 create mode 100644 logback-core/src/test/witness/rolling/tbr-test8.1.zip
 rename logback-core/src/test/witness/rolling/{tbr-missingTargetDir.2 => tbr-test8.2} (100%)


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


More information about the logback-dev mailing list