
Author: ceki Date: Wed Jul 15 15:01:59 2009 New Revision: 2354 Added: logback/trunk/logback-examples/src/main/java/chapter3/scan1.xml Modified: logback/trunk/logback-access/pom.xml logback/trunk/logback-classic/pom.xml logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeFilter.java logback/trunk/logback-core/pom.xml logback/trunk/logback-examples/pom.xml logback/trunk/logback-site/pom.xml logback/trunk/logback-site/src/site/pages/manual/configuration.html logback/trunk/logback-site/src/site/pages/news.html logback/trunk/pom.xml Log: - preparing release 0.9.16 Modified: logback/trunk/logback-access/pom.xml ============================================================================== --- logback/trunk/logback-access/pom.xml (original) +++ logback/trunk/logback-access/pom.xml Wed Jul 15 15:01:59 2009 @@ -5,7 +5,7 @@ <parent> <groupId>ch.qos.logback</groupId> <artifactId>logback-parent</artifactId> - <version>0.9.16-SNAPSHOT</version> + <version>0.9.16</version> </parent> <modelVersion>4.0.0</modelVersion> Modified: logback/trunk/logback-classic/pom.xml ============================================================================== --- logback/trunk/logback-classic/pom.xml (original) +++ logback/trunk/logback-classic/pom.xml Wed Jul 15 15:01:59 2009 @@ -5,7 +5,7 @@ <parent> <groupId>ch.qos.logback</groupId> <artifactId>logback-parent</artifactId> - <version>0.9.16-SNAPSHOT</version> + <version>0.9.16</version> </parent> <modelVersion>4.0.0</modelVersion> Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeFilter.java ============================================================================== --- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeFilter.java (original) +++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeFilter.java Wed Jul 15 15:01:59 2009 @@ -33,7 +33,12 @@ final static long INIT = System.currentTimeMillis(); final static long SENTINEL = Long.MAX_VALUE; - final static long DEFAULT_REFRESH_PERIOD = 60 * 1000; // 1 minute + /** + * Scan for changes in configuration file once every minute. + */ + // 1 minute - value mentioned in documentation + public final static long DEFAULT_REFRESH_PERIOD = 60 * 1000; + long refreshPeriod = DEFAULT_REFRESH_PERIOD; File fileToScan; protected long nextCheck; @@ -107,10 +112,10 @@ nextCheck = now + refreshPeriod; } -// String stem() { -// return currentThreadName() + ", context " + context.getName() -// + ", nextCheck=" + (nextCheck - INIT); -// } + // String stem() { + // return currentThreadName() + ", context " + context.getName() + // + ", nextCheck=" + (nextCheck - INIT); + // } // This method is synchronized to prevent near-simultaneous re-configurations protected boolean changeDetected() { Modified: logback/trunk/logback-core/pom.xml ============================================================================== --- logback/trunk/logback-core/pom.xml (original) +++ logback/trunk/logback-core/pom.xml Wed Jul 15 15:01:59 2009 @@ -5,7 +5,7 @@ <parent> <groupId>ch.qos.logback</groupId> <artifactId>logback-parent</artifactId> - <version>0.9.16-SNAPSHOT</version> + <version>0.9.16</version> </parent> <modelVersion>4.0.0</modelVersion> Modified: logback/trunk/logback-examples/pom.xml ============================================================================== --- logback/trunk/logback-examples/pom.xml (original) +++ logback/trunk/logback-examples/pom.xml Wed Jul 15 15:01:59 2009 @@ -5,7 +5,7 @@ <parent> <groupId>ch.qos.logback</groupId> <artifactId>logback-parent</artifactId> - <version>0.9.16-SNAPSHOT</version> + <version>0.9.16</version> </parent> <modelVersion>4.0.0</modelVersion> Added: logback/trunk/logback-examples/src/main/java/chapter3/scan1.xml ============================================================================== --- (empty file) +++ logback/trunk/logback-examples/src/main/java/chapter3/scan1.xml Wed Jul 15 15:01:59 2009 @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<configuration scan="true"> + + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <layout> + <Pattern>%d [%thread] %-5level %logger{36} - %msg%n</Pattern> + </layout> + </appender> + + <root level="debug"> + <appender-ref ref="STDOUT" /> + </root> + +</configuration> \ No newline at end of file Modified: logback/trunk/logback-site/pom.xml ============================================================================== --- logback/trunk/logback-site/pom.xml (original) +++ logback/trunk/logback-site/pom.xml Wed Jul 15 15:01:59 2009 @@ -3,7 +3,7 @@ <parent> <groupId>ch.qos.logback</groupId> <artifactId>logback-parent</artifactId> - <version>0.9.16-SNAPSHOT</version> + <version>0.9.16</version> </parent> <modelVersion>4.0.0</modelVersion> Modified: logback/trunk/logback-site/src/site/pages/manual/configuration.html ============================================================================== --- logback/trunk/logback-site/src/site/pages/manual/configuration.html (original) +++ logback/trunk/logback-site/src/site/pages/manual/configuration.html Wed Jul 15 15:01:59 2009 @@ -359,12 +359,10 @@ <p>If instructed to do so, logback-classic will scan for changes in its configuration file and automatically reconfigure itself when - the said configuration file changes. - </p> - - <p>Logback-classic can be instructed to scan for changes in its - configuration file and to automatically re-configure itself by - setting the <span class="attr">scan</span> atrribute of the + the said configuration file changes. In order to instruct + logback-classic to scan for changes in its configuration file and + to automatically re-configure itself set the <span + class="attr">scan</span> atrribute of the <code><configuration></code> element to true, as shown next. </p> @@ -375,8 +373,56 @@ <pre class="prettyprint source"> <configuration <b>scan="true"</b>> ... -</configuration> -</pre> +</configuration> </pre> + + + <p>By default, the configuration file will be scanned for changes + once every minute. You can specify a different scanning period by + setting the <span class="attr">scanPeriod</span> attribute of the + <code><configuration></code> element. Values can be specified in + units of milliseconds, seconds, minutes or hours. Here is an + example:</p> + + <em>Example 3.<span class="autoEx"/>: Specifying a different + scanning period + (logback-examples/src/main/java/chapter3/scan2.xml)</em> + +<pre class="prettyprint source"> +<configuration scan="true" <b>scanPeriod="30 seconds"</b> > + ... +</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> + + <p>Behind the scenes, when you set the scan attribute to true, a + <code>TurboFilter</code> called <a + href="../xref/ch/qos/logback/classic/turbo/ReconfigureOnChangeFilter.html">ReconfigureOnChangeFilter</a> + will be installed. TurboFilters are described in a <a + href="filters.html#TurboFilter">later chapter</a>. As a + consequence, scanning is done "in-thread", that is anytime a + printing method of logger is invoked. For example, for a logger + named <code>myLogger</code>, when you write + "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. + </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, + <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. + </p> + + <h3>Invoking <code>JoranConfigurator</code> directly</h3> Modified: logback/trunk/logback-site/src/site/pages/news.html ============================================================================== --- logback/trunk/logback-site/src/site/pages/news.html (original) +++ logback/trunk/logback-site/src/site/pages/news.html Wed Jul 15 15:01:59 2009 @@ -29,20 +29,39 @@ <hr width="80%" align="center" /> - <h3>Nth of July 2009 - Release of version 0.9.16</h3> + <h3>15th of July 2009 - Release of version 0.9.16</h3> + + <p>In addition to nifty new features, this release contains + several important internal changes. Given the importance of some + of those internal changes, <em>this release may be less stable + than previous logback releases</em>.</p> <p>In logback-classic, <a href="xref/ch/qos/logback/classic/spi/LoggingEvent.html"><code>LoggingEvent</code></a> now implements the <a href="xref/ch/qos/logback/classic/spi/ILoggingEvent.html"><code>ILoggingEvent</code></a> interface. All logback-classic components expect to process - <code>ILoggingEvent</code> intances. Moreover, events which sent + <code>ILoggingEvent</code> instances. Moreover, events which sent to a remote host are now of type <a href="xref/ch/qos/logback/classic/spi/LoggingEventVO.html"><code>LoggingEventVO</code></a>. </p> + <p>Logback-classic will now <a + href="manual/configuration.html#autoScan">automatically + re-configure itself</a> when its configuration file is + modified. This enhancement was requested in <a + href="http://jira.qos.ch/browse/LBCORE-59">LBCORE-59</a> by + Michael Osipov.</p> + + <p>FileAppender and its derived class RolllingFileAppender are now + based on a finer-grain synchronization model. This change is aimed + at reducing various synchronization related bugs, namely <a + href="http://jira.qos.ch/browse/LBCLASSIC-135">LBCLASSIC-135</a> + and its various sub-tasks. + </p> + <p>Fixed a bug in the localLevelReset() method in the - <code>Logger</code> class whcih inadvertently used the DEBUG_INT + <code>Logger</code> class which inadvertently used the DEBUG_INT value in the org.slf4j.spi.LocationAwareLogger interface instead of the DEBUG_INT value in ch.qos.logback.classic.Level class. The issue was first identified by Andy Ruch <a Modified: logback/trunk/pom.xml ============================================================================== --- logback/trunk/pom.xml (original) +++ logback/trunk/pom.xml Wed Jul 15 15:01:59 2009 @@ -5,7 +5,7 @@ <groupId>ch.qos.logback</groupId> <artifactId>logback-parent</artifactId> - <version>0.9.16-SNAPSHOT</version> + <version>0.9.16</version> <packaging>pom</packaging> <name>Logback-Parent</name>