[logback-dev] [GIT] Logback: the generic, reliable, fast and flexible logging framework. branch, master, updated. v0.9.20-6-g157bc93

added by portage for gitosis-gentoo git-noreply at pixie.qos.ch
Fri Apr 16 22:55:46 CEST 2010


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  157bc935c2f939dc73137f1f01e1a1f36526f913 (commit)
      from  6e526ff11d650992626ea5ff20e7f0751c493789 (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=157bc935c2f939dc73137f1f01e1a1f36526f913
http://github.com/ceki/logback/commit/157bc935c2f939dc73137f1f01e1a1f36526f913

commit 157bc935c2f939dc73137f1f01e1a1f36526f913
Author: Ceki Gulcu <ceki at qos.ch>
Date:   Fri Apr 16 22:53:54 2010 +0200

    identidied syncronization prroblem in SiftingAppenderBase as shown by
    http://jira.qos.ch/browse/LBCLASSIC-203

diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/issue/lbclassic203/ConcurrentSiftingTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/issue/lbclassic203/ConcurrentSiftingTest.java
new file mode 100644
index 0000000..0400413
--- /dev/null
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/issue/lbclassic203/ConcurrentSiftingTest.java
@@ -0,0 +1,25 @@
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2010, QOS.ch. All rights reserved.
+ * 
+ * This program and the accompanying materials are dual-licensed under either
+ * the terms of the Eclipse Public License v1.0 as published by the Eclipse
+ * Foundation
+ * 
+ * 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.
+ */
+package ch.qos.logback.classic.issue.lbclassic203;
+
+import org.junit.Test;
+
+
+public class ConcurrentSiftingTest {
+  
+  @Test
+  public void test() {
+    throw new IllegalStateException("");
+  }
+}
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/issue/lbclassic203/LogbackRolloverTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/issue/lbclassic203/LogbackRolloverTest.java
new file mode 100644
index 0000000..cc5f86f
--- /dev/null
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/issue/lbclassic203/LogbackRolloverTest.java
@@ -0,0 +1,67 @@
+package ch.qos.logback.classic.issue.lbclassic203;
+
+import java.util.Date;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class LogbackRolloverTest extends Thread {
+  private static Logger log = LoggerFactory
+      .getLogger(LogbackRolloverTest.class);
+  private static final int DEFAULT_THREAD_COUNT = 2;
+  private static int threadcount = DEFAULT_THREAD_COUNT;
+
+  public static void main(String[] args) {
+    if (args.length > 0) {
+      try {
+        threadcount = Integer.parseInt(args[0]);
+      } catch (Exception e) {
+        System.out
+            .println("Usage: LogbackRolloverTest [<thread count>] (defaults to "
+                + DEFAULT_THREAD_COUNT + " threads)");
+        System.exit(1);
+      }
+    }
+    System.out.println("Logging from " + threadcount
+        + (threadcount == 1 ? " thread" : " threads")
+        + " (optional thread count parameter defaults to "
+        + DEFAULT_THREAD_COUNT + ")");
+
+    for (int i = 0; i < threadcount; i++) {
+      new LogbackRolloverTest().start();
+    }
+  }
+
+  public void run() {
+    int count = 0;
+    while (true) {
+      doLog(count++);
+    }
+  }
+
+  private void doLog(int count) {
+    log.debug("The current date is " + new Date() + " the count is " + count);
+    log.info("Info Message");
+    log.warn("Warn Message");
+    log.trace("Trace  message");
+    log.error("Error message");
+    log.info("Info Message");
+    log.warn("Warn Message");
+    log.trace("Trace  message");
+    log.error("Error message");
+    try {
+      throw new Exception("throwing exception " + count
+          + " to create a stack trace");
+    } catch (Exception e) {
+      log.error("caught " + e.toString(), e);
+    }
+    if (count % 10 == 0) {
+      try {
+        Thread.sleep(500);
+      } catch (InterruptedException e) {
+        log.error("Thread interrupted: " + e.toString(), e);
+      }
+    }
+
+  }
+}
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 ca86f4c..4e388b2 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
@@ -68,7 +68,6 @@ public class AppenderTrackerImpl<E> implements AppenderTracker<E> {
     lastCheck = now;
     while (head.value != null && isEntryStale(head,now)) {
       Appender<E> appender = head.value;
-      //System.out.println("  stopping "+appender);
       appender.stop();
       removeHead();
     }
diff --git a/logback-core/src/main/java/ch/qos/logback/core/sift/SiftingAppenderBase.java b/logback-core/src/main/java/ch/qos/logback/core/sift/SiftingAppenderBase.java
index c82ed9b..865f040 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/sift/SiftingAppenderBase.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/sift/SiftingAppenderBase.java
@@ -14,8 +14,8 @@
 package ch.qos.logback.core.sift;
 
 import ch.qos.logback.core.Appender;
+import ch.qos.logback.core.AppenderBase;
 import ch.qos.logback.core.CoreConstants;
-import ch.qos.logback.core.UnsynchronizedAppenderBase;
 import ch.qos.logback.core.helpers.NOPAppender;
 import ch.qos.logback.core.joran.spi.JoranException;
 
@@ -29,7 +29,7 @@ import ch.qos.logback.core.joran.spi.JoranException;
  * @author Ceki Gulcu
  */
 public abstract class SiftingAppenderBase<E> extends
-    UnsynchronizedAppenderBase<E> {
+    AppenderBase<E> {
 
   protected AppenderTracker<E> appenderTracker = new AppenderTrackerImpl<E>();
   AppenderFactoryBase<E> appenderFactory;
@@ -73,9 +73,8 @@ public abstract class SiftingAppenderBase<E> extends
 
     String discriminatingValue = discriminator.getDiscriminatingValue(event);
     long timestamp = getTimestamp(event);
-
+    
     Appender<E> appender = appenderTracker.get(discriminatingValue, timestamp);
-
     if (appender == null) {
       try {
         appender = appenderFactory.buildAppender(context, discriminatingValue);
@@ -91,6 +90,7 @@ public abstract class SiftingAppenderBase<E> extends
       }
     }
     appenderTracker.stopStaleAppenders(timestamp);
+    
     appender.doAppend(event);
   }
 
diff --git a/logback-site/src/site/pages/index.html b/logback-site/src/site/pages/index.html
index 07760e2..3e79dd3 100644
--- a/logback-site/src/site/pages/index.html
+++ b/logback-site/src/site/pages/index.html
@@ -66,26 +66,28 @@
       <tr>
         <td valign="top">
           <ul> 
+            <li><a href="http://jackrabbit.apache.org/">Apache Jackrabbit</a></li>
             <li><a href="http://www.jfrog.org/products.php">Artifactory</a></li>
             <li><a href="http://cia.sourceforge.net/">Citizen Intelligence Agency</a></li>
             <li><a href="http://www.geomajas.org/">Geomajas</a></li>            
-            <li><a href="http://www.gradle.org/">Gradle</a></li>            
-            <li><a href="http://jmxmonitor.sourceforge.net/">JMX Monitor</a></li>
-          
+            <li><a href="http://www.gradle.org/">Gradle</a></li>   
+       
           </ul>
         </td>
         <td>
           <ul>            
+            <li><a href="http://jmxmonitor.sourceforge.net/">JMX Monitor</a></li>          
+            <li><a href="http://www.opengda.org/">OpenGDA</a></li>   
             <li><a href="http://code.google.com/p/openmeetings/">OpenMeetings</a></li>
             <li><a href="http://liftweb.net/">Lift</a></li>
             <li><a href="http://www.red5.org">Red5</a></li>
-            <li><a href="http://scalate.fusesource.org/">Scalate</a></li>
-            <li><a href="http://sonar.codehaus.org/">Sonar</a></li>
           </ul>
         </td>
 
         <td valign="top">
           <ul>
+            <li><a href="http://scalate.fusesource.org/">Scalate</a></li>
+            <li><a href="http://sonar.codehaus.org/">Sonar</a></li>
             <li><a
             href="http://static.springsource.org/s2-dmserver/2.0.x/user-guide/htmlsingle/user-guide.html">SpringSource
             dm Server</a></li>  

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

Summary of changes:
 .../issue/lbclassic203/ConcurrentSiftingTest.java  |   13 +++-
 .../issue/lbclassic203/LogbackRolloverTest.java    |   67 ++++++++++++++++++++
 .../qos/logback/core/sift/AppenderTrackerImpl.java |    1 -
 .../qos/logback/core/sift/SiftingAppenderBase.java |    8 +-
 logback-site/src/site/pages/index.html             |   12 ++--
 5 files changed, 88 insertions(+), 13 deletions(-)
 copy logback-core/src/main/java/ch/qos/logback/core/joran/conditional/Condition.java => logback-classic/src/test/java/ch/qos/logback/classic/issue/lbclassic203/ConcurrentSiftingTest.java (71%)
 create mode 100644 logback-classic/src/test/java/ch/qos/logback/classic/issue/lbclassic203/LogbackRolloverTest.java


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


More information about the logback-dev mailing list