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

Gitbot git-noreply at pixie.qos.ch
Thu Apr 26 14:31:31 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  aa37a6acaa0acdd3efb535177deca02c7b0772d7 (commit)
      from  369b71c9c28d38dd45af49925d88d4853fb6679a (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=aa37a6acaa0acdd3efb535177deca02c7b0772d7
http://github.com/ceki/logback/commit/aa37a6acaa0acdd3efb535177deca02c7b0772d7

commit aa37a6acaa0acdd3efb535177deca02c7b0772d7
Author: Ceki Gulcu <ceki at qos.ch>
Date:   Thu Apr 26 14:30:42 2012 +0200

    minor edits

diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeFilter.java b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeFilter.java
index 08869c3..88aa742 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeFilter.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeFilter.java
@@ -32,6 +32,7 @@ import ch.qos.logback.classic.LoggerContext;
 import ch.qos.logback.classic.joran.JoranConfigurator;
 import ch.qos.logback.core.joran.spi.JoranException;
 import ch.qos.logback.core.spi.FilterReply;
+import scala.xml.factory.LoggedNodeFactory;
 
 import static ch.qos.logback.core.CoreConstants.MILLIS_IN_ONE_SECOND;
 
@@ -88,7 +89,7 @@ public class ReconfigureOnChangeFilter extends TurboFilter {
   private long invocationCounter = 0;
 
   private volatile long mask = 0xF;
-  private long lastMaskCheck = System.currentTimeMillis();
+  private volatile long lastMaskCheck = System.currentTimeMillis();
 
 
   @Override
@@ -122,17 +123,26 @@ public class ReconfigureOnChangeFilter extends TurboFilter {
     return FilterReply.NEUTRAL;
   }
 
-  // for CPU intensive applications with 200 or more threads MASK values in the order of 0xFFFF is appropriate
+  // experiments indicate that even for CPU intensive applications with 200 or more threads MASK
+  // values in the order of 0xFFFF is appropriate
   private static final int MAX_MASK = 0xFFFF;
 
-  // update the mask so as to execute change detection code about once every 1 to 8 seconds.
+
+  // if less  than MASK_INCREASE_THRESHOLD milliseconds elapse between invocations of updateMaskIfNecessary() method,
+  // then the mask should be increased
+  private static final long MASK_INCREASE_THRESHOLD = 100;
+
+  // if more than MASK_DECREASE_THRESHOLD milliseconds elapse between invocations of updateMaskIfNecessary() method,
+  // then the mask should be decreased
+  private static final long MASK_DECREASE_THRESHOLD = MASK_INCREASE_THRESHOLD*8;
+
+  // update the mask so as to execute change detection code about once every 100 to 8000 milliseconds.
   private void updateMaskIfNecessary(long now) {
-    // if less than 1s elapsed since last maskUpdate double the mask size and add 1
-    final long timeElapsedSinceLastCheck = now - lastMaskCheck;
+    final long timeElapsedSinceLastMaskUpdateCheck = now - lastMaskCheck;
     lastMaskCheck = now;
-    if (timeElapsedSinceLastCheck < MILLIS_IN_ONE_SECOND && (mask < MAX_MASK)) {
+    if (timeElapsedSinceLastMaskUpdateCheck < MASK_INCREASE_THRESHOLD && (mask < MAX_MASK)) {
         mask = (mask << 1) | 1;
-    } else if (timeElapsedSinceLastCheck > 8*MILLIS_IN_ONE_SECOND) {
+    } else if (timeElapsedSinceLastMaskUpdateCheck > MASK_DECREASE_THRESHOLD) {
       mask = mask >>> 2;
     }
   }
diff --git a/logback-classic/src/test/input/turbo/inclusion/topByResource.xml b/logback-classic/src/test/input/turbo/inclusion/topByResource.xml
index 82f5590..2037953 100644
--- a/logback-classic/src/test/input/turbo/inclusion/topByResource.xml
+++ b/logback-classic/src/test/input/turbo/inclusion/topByResource.xml
@@ -2,7 +2,7 @@
 <!DOCTYPE x>
 
 
-<configuration scan="true" scanPeriod="50 millisecond">
+<configuration scan="true" scanPeriod="50 milliseconds">
   <include resource="asResource/inner1.xml"/>
 </configuration> 
        
diff --git a/logback-classic/src/test/input/turbo/inclusion/topLevel0.xml b/logback-classic/src/test/input/turbo/inclusion/topLevel0.xml
index 48ac9f7..aacf72a 100644
--- a/logback-classic/src/test/input/turbo/inclusion/topLevel0.xml
+++ b/logback-classic/src/test/input/turbo/inclusion/topLevel0.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE configuration>
 
-<configuration scan="true" scanPeriod="50 millisecond">
+<configuration scan="true" scanPeriod="50 milliseconds">
 
   <include file="src/test/input/turbo/inclusion/inner0.xml"/>
 
diff --git a/logback-classic/src/test/input/turbo/scan_perf.xml b/logback-classic/src/test/input/turbo/scan_perf.xml
index d652491..0e87a65 100644
--- a/logback-classic/src/test/input/turbo/scan_perf.xml
+++ b/logback-classic/src/test/input/turbo/scan_perf.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE configuration>
 
-<configuration scan="true" scanPeriod="50 millisecond">
+<configuration debug="true" scan="true" scanPeriod="30 seconds">
 
   <appender name="FILE" class="ch.qos.logback.core.FileAppender">
    <File>target/test-output/testFile.log</File>
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/issue/lbclassic135/LoggingRunnable.java b/logback-classic/src/test/java/ch/qos/logback/classic/issue/lbclassic135/LoggingRunnable.java
index 602bb4a..351efa2 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/issue/lbclassic135/LoggingRunnable.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/issue/lbclassic135/LoggingRunnable.java
@@ -40,7 +40,7 @@ public class LoggingRunnable extends RunnableWithCounterAndDone {
         try {
           Thread.sleep(1);
         } catch (InterruptedException e) {
-          e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+          e.printStackTrace();
         }
       }
     }
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeTest.java
index d451b1b..7c7a810 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeTest.java
@@ -73,18 +73,11 @@ public class ReconfigureOnChangeTest {
   final static String INCLUSION_SCAN_TOPLEVEL0_AS_STR = ClassicTestConstants.INPUT_PREFIX
           + "turbo/inclusion/topLevel0.xml";
 
-  final static String INCLUSION_SCAN_TOPLEVEL2_AS_STR = ClassicTestConstants.INPUT_PREFIX
-          + "turbo/inclusion/topLevel2.xml";
-
   final static String INCLUSION_SCAN_TOP_BY_RESOURCE_AS_STR = ClassicTestConstants.INPUT_PREFIX
           + "turbo/inclusion/topByResource.xml";
 
-
   final static String INCLUSION_SCAN_INNER0_AS_STR = ClassicTestConstants.INPUT_PREFIX
           + "turbo/inclusion/inner0.xml";
-  final static String INCLUSION_SCAN_INNER2_AS_STR = ClassicTestConstants.INPUT_PREFIX
-          + "turbo/inclusion/inner2.xml";
-
 
   final static String INCLUSION_SCAN_INNER1_AS_STR = "target/test-classes/asResource/inner1.xml";
 
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/ReconfigurePerf.java b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/ReconfigurePerf.java
index dd93afb..ef2a210 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/ReconfigurePerf.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/ReconfigurePerf.java
@@ -47,7 +47,7 @@ public class ReconfigurePerf {
 
   int sleepBetweenUpdates = DEFAULT_SLEEP_BETWEEN_UPDATES;
 
-  static int numberOfCycles = 150;
+  static int numberOfCycles = 100;
   static int totalTestDuration;
 
   LoggerContext loggerContext = new LoggerContext();
diff --git a/logback-site/src/site/pages/manual/configuration.html b/logback-site/src/site/pages/manual/configuration.html
index df1679a..2c81abe 100644
--- a/logback-site/src/site/pages/manual/configuration.html
+++ b/logback-site/src/site/pages/manual/configuration.html
@@ -448,10 +448,10 @@ public class Foo {
   ...
 </configuration> </pre>
 
-   <p>If no unit of time is specified, then the unit of time is
-   assumed to be milliseconds, which is usually inappropriate. If you
-   change the default scanning period, do not forget to specify a time
-   unit.
+   <p><span class="label">Note</span> If no unit of time is specified,
+   then the unit of time is assumed to be milliseconds, which is
+   usually inappropriate. If you change the default scanning period,
+   do not forget to specify a time unit.
    </p>
 
    <p>Behind the scenes, when you set the scan attribute to true, a
@@ -465,17 +465,25 @@ public class Foo {
    "myLogger.debug("hello");", and if the scan attribute is set to
    true, then <code>ReconfigureOnChangeFilter</code> will be
    invoked. Moreover, the said filter will be invoked even if
-   <code>myLogger</code> is disabled for the debug level.
+   <code>myLogger</code> is disabled for the DEBUG level.
    </p>
 
    <p>Given that <code>ReconfigureOnChangeFilter</code> is invoked
-   every time <em>any</em> logger is invoked, the filter is
-   performance critical. In order to improve performance, instead of
-   checking whether to scan or not on every logger invocation,
+   every time <em>any</em> logger is invoked, regardless of logger
+   level, <code>ReconfigureOnChangeFilter</code> is absolutely
+   performance critical. So much so that in fact, the check whether
+   the scan period has elapsed or not, is too costly in itself. In
+   order to improve performance,
    <code>ReconfigureOnChangeFilter</code> is in reality "alive" only
-   once every 16 logging operations. In short, when a configuration
-   file changes, it will be automatically reloaded after a delay
-   determined by the scanning period and several logger invocations.
+   once every <em>N</em> logging operations.  Depending on how often
+   your application logs, the value of <em>N</em> can be modified on
+   the fly by logback. By default N is 16, altough it can go as high
+   as 2^16 (= 65536) for CPU-intensive applications.
+   </p>
+   
+   <p>In short, when a configuration file changes, it will be
+   automatically reloaded but only after several logger invocations
+   <em>and</em> after a delay determined by the scanning period.
    </p>
 
    
diff --git a/logback-site/src/site/pages/news.html b/logback-site/src/site/pages/news.html
index 6b88b35..7d9d0f4 100644
--- a/logback-site/src/site/pages/news.html
+++ b/logback-site/src/site/pages/news.html
@@ -29,9 +29,31 @@
 
     <hr width="80%" align="center" />
 
-    <h3>Xth of April, 2012 - Release of version 1.0.2</h3>
+    <h3>26th of April, 2012 - Release of version 1.0.2</h3>
 
+    <div style="border: 1px solid #F44; background-color: #FED; padding-left: 1ex; padding-right: 1ex;">
+
+    <h4>Breaking change: <code>PatternLayout</code> will now output
+    its pattern at the top of log files</h4>
+
+    <p>In order to facilitate parsing of log files, logback now
+    inserts the pattern used for the log output at the top of each log
+    file. This feature was requested by James Strachan in <a
+    href="http://jira.qos.ch/browse/LBCORE-234">LBCORE-234</a>.
+    </p>
+
+    <p>Here an example:</p>
 
+    <pre>#logback.classic pattern: %d [%thread] %-5level %logger{36} - %msg%n
+2012-04-26 14:54:38,461 [main] DEBUG com.foo.App - Hello world
+2012-04-26 14:54:38,461 [main] DEBUG com.foo.App - Hi again
+...</pre>
+
+     <p>The line starting with "#logback.classic pattern" is newly
+     inserted pattern line.</p>
+
+    </div>
+    
     <p><code>ReconfigureOnChangeFilter</code> will avoid excessive
     syncronization in case of CPU intensive applications. This fixes
     <a

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

Summary of changes:
 .../classic/turbo/ReconfigureOnChangeFilter.java   |   24 +++++++++++----
 .../test/input/turbo/inclusion/topByResource.xml   |    2 +-
 .../src/test/input/turbo/inclusion/topLevel0.xml   |    2 +-
 logback-classic/src/test/input/turbo/scan_perf.xml |    2 +-
 .../issue/lbclassic135/LoggingRunnable.java        |    2 +-
 .../classic/turbo/ReconfigureOnChangeTest.java     |    7 ----
 .../qos/logback/classic/turbo/ReconfigurePerf.java |    2 +-
 .../src/site/pages/manual/configuration.html       |   30 ++++++++++++-------
 logback-site/src/site/pages/news.html              |   24 +++++++++++++++-
 9 files changed, 64 insertions(+), 31 deletions(-)


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


More information about the logback-dev mailing list