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  a7582c96029b7666fb2a0380dd8a60af2cce613c (commit)
      from  40fb027ac8d80af4b0fe0d6dff595eafa335fbfa (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=a7582c96029b7666fb2a0380dd8a60af2cce613c
http://github.com/ceki/logback/commit/a7582c96029b7666fb2a0380dd8a60af2cce613c

commit a7582c96029b7666fb2a0380dd8a60af2cce613c
Author: Ceki Gulcu <[email protected]>
Date:   Wed Mar 9 19:20:47 2011 +0100

    ongoing work

diff --git a/logback-classic/src/test/input/gaffer/x.groovy 
b/logback-classic/src/test/input/gaffer/x.groovy
new file mode 100644
index 0000000..22d6db4
--- /dev/null
+++ b/logback-classic/src/test/input/gaffer/x.groovy
@@ -0,0 +1,62 @@
+import ch.qos.logback.classic.PatternLayout
+import ch.qos.logback.classic.filter.ThresholdFilter
+import ch.qos.logback.classic.net.SMTPAppender
+import ch.qos.logback.core.ConsoleAppender
+import ch.qos.logback.core.rolling.FixedWindowRollingPolicy
+import ch.qos.logback.core.rolling.RollingFileAppender
+import ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy
+
+
+import static ch.qos.logback.classic.Level.ERROR
+import static ch.qos.logback.classic.Level.INFO
+
+
+
+appender("RootFileAppender", RollingFileAppender) {
+  file = "project"
+  append = true
+  filter(ThresholdFilter) {
+    level = INFO
+  }
+  rollingPolicy(FixedWindowRollingPolicy) {
+    fileNamePattern = "project_log.%i"
+    maxIndex = 1
+  }
+  triggeringPolicy(SizeBasedTriggeringPolicy) {
+    maxFileSize = 1000000
+  }
+
+  layout(PatternLayout) {
+    pattern = "%d{yyyy-MM-dd HH:mm:ss}, %p, %c, %t, %ex, %F, %L, %C{1}, %M 
%m%n"
+  }
+}
+
+appender("RootConsoleAppender", ConsoleAppender) {
+  filter(ThresholdFilter) {
+    level = INFO
+  }
+
+  layout(PatternLayout) {
+    pattern = "%d{yyyy-MM-dd HH:mm:ss}, %p, %c, %t %m%n"
+  }
+}
+
+appender("RootEmailAppender", SMTPAppender) {
+  filter(ThresholdFilter) {
+    level = ERROR
+  }
+  bufferSize = 10
+  SMTPHost = "smtp.hostaddress"
+  to = "[email protected]"
+  from = " [email protected] "
+  username = "user"
+  password = "password"
+  subject = "Logback Error"
+
+  layout(PatternLayout) {
+    pattern = "%d{yyyy-MM-dd HH:mm:ss}, %p, %c, %t, %ex, %F, %L, %C{1}, %M 
%m%n"
+  }
+
+}
+
+root(INFO, ["RootFileAppender", "RootConsoleAppender", "RootEmailAppender"])
\ No newline at end of file
diff --git 
a/logback-classic/src/test/java/ch/qos/logback/classic/util/LogbackMDCAdapterTest.java
 
b/logback-classic/src/test/java/ch/qos/logback/classic/util/LogbackMDCAdapterTest.java
index 7799af7..b4bb459 100644
--- 
a/logback-classic/src/test/java/ch/qos/logback/classic/util/LogbackMDCAdapterTest.java
+++ 
b/logback-classic/src/test/java/ch/qos/logback/classic/util/LogbackMDCAdapterTest.java
@@ -108,7 +108,7 @@ public class LogbackMDCAdapterTest {
     }
   }
 
-  // ================================================= 
+  // =================================================
 
   /**
    * Test that LogbackMDCAdapter copies its hashmap when a child
@@ -146,6 +146,28 @@ public class LogbackMDCAdapterTest {
 
   }
 
+  // see also http://jira.qos.ch/browse/LBCLASSIC-253
+  @Test
+  public void clearOnChildThreadShouldNotAffectParent() throws 
InterruptedException {
+    String firstKey = "x" + diff;
+    String secondKey = "o" + diff;
+
+    MDC.put(firstKey, firstKey+A_SUFFIX);
+    assertEquals(firstKey+A_SUFFIX, MDC.get(firstKey));
+
+    Thread clearer = new ChildThreadForMDC(firstKey, secondKey) {
+      @Override
+      public void run() {
+        MDC.clear();
+        assertNull(MDC.get(firstKey));
+      }
+    };
+
+    clearer.start();
+    clearer.join();
+
+    assertEquals(firstKey+A_SUFFIX, MDC.get(firstKey));
+  }
 
   class ChildThreadForMDC extends Thread {
 
@@ -155,6 +177,10 @@ public class LogbackMDCAdapterTest {
     HashMap<String, String> childHM;
     CountDownLatch countDownLatch;
 
+    ChildThreadForMDC(String firstKey, String secondKey) {
+      this(firstKey, secondKey, null);
+    }
+
     ChildThreadForMDC(String firstKey, String secondKey, CountDownLatch 
countDownLatch) {
       this.firstKey = firstKey;
       this.secondKey = secondKey;
@@ -166,7 +192,7 @@ public class LogbackMDCAdapterTest {
       MDC.put(secondKey, secondKey + A_SUFFIX);
       assertNotNull(MDC.get(firstKey));
       assertEquals(firstKey + A_SUFFIX, MDC.get(firstKey));
-      countDownLatch.countDown();
+      if(countDownLatch != null) countDownLatch.countDown();
       assertEquals(secondKey + A_SUFFIX, MDC.get(secondKey));
       successul = true;
       childHM = getHashMapFromMDC();
diff --git 
a/logback-core/src/main/java/ch/qos/logback/core/rolling/TimeBasedRollingPolicy.java
 
b/logback-core/src/main/java/ch/qos/logback/core/rolling/TimeBasedRollingPolicy.java
index 40d3713..1159aa5 100644
--- 
a/logback-core/src/main/java/ch/qos/logback/core/rolling/TimeBasedRollingPolicy.java
+++ 
b/logback-core/src/main/java/ch/qos/logback/core/rolling/TimeBasedRollingPolicy.java
@@ -71,8 +71,8 @@ public class TimeBasedRollingPolicy<E> extends 
RollingPolicyBase implements
     compressor.setContext(context);
 
     // wcs : without compression suffix
-    fileNamePatternWCS = new FileNamePattern(computeFileNameStr_WCS(
-        fileNamePatternStr, compressionMode), this.context);
+    fileNamePatternWCS = new FileNamePattern(Compressor.computeFileNameStr_WCS(
+            fileNamePatternStr, compressionMode), this.context);
 
     addInfo("Will use the pattern " + fileNamePatternWCS
         + " for the active file");
@@ -104,20 +104,6 @@ public class TimeBasedRollingPolicy<E> extends 
RollingPolicyBase implements
     return timeBasedFileNamingAndTriggeringPolicy;
   }
 
-  static public String computeFileNameStr_WCS(String fileNamePatternStr,
-      CompressionMode compressionMode) {
-    int len = fileNamePatternStr.length();
-    switch (compressionMode) {
-    case GZ:
-      return fileNamePatternStr.substring(0, len - 3);
-    case ZIP:
-      return fileNamePatternStr.substring(0, len - 4);
-    case NONE:
-      return fileNamePatternStr;
-    }
-    throw new IllegalStateException("Execution should not reach this point");
-  }
-
   public void rollover() throws RolloverFailure {
 
     // when rollover is called the elapsed period's file has
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 d664d66..cb2f899 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
@@ -35,20 +35,10 @@ public class Compressor extends ContextAwareBase {
 
   final CompressionMode compressionMode;
 
-  // final String nameOfFile2Compress;
-  // final String nameOfCompressedFile;
-
   public Compressor(CompressionMode compressionMode) {
     this.compressionMode = compressionMode;
   }
 
-  // public Compressor(CompressionMode compressionMode, String
-  // nameOfFile2Compress, String nameOfCompressedFile) {
-  // this.compressionMode = compressionMode;
-  // //this.nameOfFile2Compress = nameOfFile2Compress;
-  // //this.nameOfCompressedFile = nameOfCompressedFile;
-  // }
-
   public void compress(String nameOfFile2Compress, String 
nameOfCompressedFile) {
     switch (compressionMode) {
     case GZ:
@@ -132,8 +122,7 @@ public class Compressor extends ContextAwareBase {
   // all having the same name, which could make it harder for the user
   // to unzip the file without collisions
   ZipEntry computeZipEntry(File zippedFile) {
-    String nameOfFileNestedWithinArchive = TimeBasedRollingPolicy
-        .computeFileNameStr_WCS(zippedFile.getName(), compressionMode);
+    String nameOfFileNestedWithinArchive = 
computeFileNameStr_WCS(zippedFile.getName(), compressionMode);
     return new ZipEntry(nameOfFileNestedWithinArchive);
   }
 
@@ -184,6 +173,20 @@ public class Compressor extends ContextAwareBase {
     }
   }
 
+  static public String computeFileNameStr_WCS(String fileNamePatternStr,
+                                              CompressionMode compressionMode) 
{
+    int len = fileNamePatternStr.length();
+    switch (compressionMode) {
+      case GZ:
+        return fileNamePatternStr.substring(0, len - 3);
+      case ZIP:
+        return fileNamePatternStr.substring(0, len - 4);
+      case NONE:
+        return fileNamePatternStr;
+    }
+    throw new IllegalStateException("Execution should not reach this point");
+  }
+
   @Override
   public String toString() {
     return "c.q.l.core.rolling.helper.Compress";
diff --git a/logback-core/src/test/scala/ch/qos/logback/core/rolling/A.scala 
b/logback-core/src/test/scala/ch/qos/logback/core/rolling/A.scala
deleted file mode 100644
index b446737..0000000
--- a/logback-core/src/test/scala/ch/qos/logback/core/rolling/A.scala
+++ /dev/null
@@ -1,41 +0,0 @@
-package ch.qos.logback.core.rolling
-
-import collection.mutable.ListBuffer
-import org.junit.Test
-
-/**
- * Created by IntelliJ IDEA.
- * User: ceki
- * Date: 27.12.10
- * Time: 14:19
- * To change this template use File | Settings | File Templates.
- */
-
-class A {
-
-
-  val initial = List(1,2, 3, 5)
-  def mon[B](f: Int => B): List[B] = {
-    val b = new ListBuffer[B]
-    var these = initial
-    while (!these.isEmpty) {
-      var that = f(these.head)
-      b += that
-      these = these.tail
-    }
-    b.toList
-  }
-
-  def asString(in: Any):String = {
-    "-"+ in.toString;
-  }
-
-  @Test
-  def doTest() {
-     val res: List[String] = mon(asString);
-     println(res)
-
-
-  }
-
-}
\ No newline at end of file
diff --git 
a/logback-core/src/test/scala/ch/qos/logback/core/rolling/LBCORE_199.scala 
b/logback-core/src/test/scala/ch/qos/logback/core/rolling/LBCORE_199.scala
new file mode 100644
index 0000000..fc7ea2a
--- /dev/null
+++ b/logback-core/src/test/scala/ch/qos/logback/core/rolling/LBCORE_199.scala
@@ -0,0 +1,62 @@
+package ch.qos.logback.core.rolling
+
+import org.junit.{Before, Test}
+import ch.qos.logback.core.encoder.EchoEncoder
+import ch.qos.logback.core.util.StatusPrinter
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: ceki
+ * Date: 09.03.11
+ * Time: 18:11
+ * To change this template use File | Settings | File Templates.
+ */
+
+class LBCORE_199 extends RollingScaffolding {
+
+  private[rolling] var rfa: RollingFileAppender[AnyRef] = new 
RollingFileAppender[AnyRef]
+  private[rolling] var fwrp: FixedWindowRollingPolicy[AnyRef] = new 
FixedWindowRollingPolicy[AnyRef]
+  private[rolling] var triggeringPolicy = new SizeBasedTriggeringPolicy[AnyRef]
+  private[rolling] var encoder: EchoEncoder[AnyRef] = new EchoEncoder[AnyRef]
+
+  @Before
+  def setUp: Unit = {
+    setUpScaffolding
+    fwrp.setContext(context)
+    rfa.setContext(context)
+    triggeringPolicy.setContext(context)
+  }
+
+  private[rolling] def initRFA(filename: String): Unit = {
+    rfa.setEncoder(encoder)
+    if (filename != null) {
+      rfa.setFile(filename)
+    }
+  }
+
+  @Test
+  def smoke() {
+    println("ba")
+    initRFA("toto.log")
+    fwrp.setFileNamePattern("tests.%i.log.gz")
+    fwrp.minIndex = 1
+    fwrp.maxIndex = 3
+    fwrp.setParent(rfa)
+    fwrp.start
+    triggeringPolicy.setMaxFileSize("20")
+    triggeringPolicy.start
+    rfa.triggeringPolicy = triggeringPolicy
+    rfa.rollingPolicy = fwrp
+    rfa.start
+
+    for (i <- 1 to 100) {
+      Thread.sleep(10)
+      rfa.doAppend("hello "+i)
+    }
+
+    StatusPrinter.print(context)
+
+  }
+
+
+}
\ No newline at end of file
diff --git a/logback-site/src/site/pages/news.html 
b/logback-site/src/site/pages/news.html
index 2304328..2cb6553 100644
--- a/logback-site/src/site/pages/news.html
+++ b/logback-site/src/site/pages/news.html
@@ -35,6 +35,12 @@
     a performace issue in <code>LogbackMDCAdapter</code> as reported
     by Michael Franz.</p>
 
+    <p>Given that events reference a snapshot of the current MDC map,
+    the snapshot should not be cleared upon invocation of the
+    MDC.clear operation. This issue was reported in <a
+    href="http://jira.qos.ch/browse/LBCLASSIC-253";>LBCLASSIC-253</a>
+    by Tommy Becker and independently fixed by the changes designated
+    to fix LBCLASSIC-254</p>.
 
     <p><code>ConfigurationWatchList</code> no longer emits an error
     message when it encouters a configuraton file placed in a jar

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

Summary of changes:
 logback-classic/src/test/input/gaffer/x.groovy     |   62 ++++++++++++++++++++
 .../classic/util/LogbackMDCAdapterTest.java        |   30 +++++++++-
 .../core/rolling/TimeBasedRollingPolicy.java       |   18 +-----
 .../logback/core/rolling/helper/Compressor.java    |   27 +++++----
 .../test/scala/ch/qos/logback/core/rolling/A.scala |   41 -------------
 .../ch/qos/logback/core/rolling/LBCORE_199.scala   |   62 ++++++++++++++++++++
 logback-site/src/site/pages/news.html              |    6 ++
 7 files changed, 175 insertions(+), 71 deletions(-)
 create mode 100644 logback-classic/src/test/input/gaffer/x.groovy
 delete mode 100644 
logback-core/src/test/scala/ch/qos/logback/core/rolling/A.scala
 create mode 100644 
logback-core/src/test/scala/ch/qos/logback/core/rolling/LBCORE_199.scala


hooks/post-receive
-- 
Logback: the generic, reliable, fast and flexible logging framework.
_______________________________________________
logback-dev mailing list
[email protected]
http://qos.ch/mailman/listinfo/logback-dev

Reply via email to