
Author: ceki Date: Sun Dec 28 21:22:44 2008 New Revision: 2109 Removed: logback/trunk/logback-site/src/site/pages/manual/contextSelector.html Modified: logback/trunk/logback-classic/src/main/java/org/slf4j/impl/StaticLoggerBinder.java logback/trunk/logback-site/src/site/pages/manual/loggingSeparation.html logback/trunk/logback-site/src/site/pages/news.html Log: Documentation enhancements. Closing LBCLASSIC-30 Modified: logback/trunk/logback-classic/src/main/java/org/slf4j/impl/StaticLoggerBinder.java ============================================================================== --- logback/trunk/logback-classic/src/main/java/org/slf4j/impl/StaticLoggerBinder.java (original) +++ logback/trunk/logback-classic/src/main/java/org/slf4j/impl/StaticLoggerBinder.java Sun Dec 28 21:22:44 2008 @@ -51,24 +51,23 @@ * The unique instance of this class. */ private static StaticLoggerBinder SINGLETON = new StaticLoggerBinder(); - + static { SINGLETON.init(); } - + private boolean initialized = false; private LoggerContext defaultLoggerContext = new LoggerContext(); private ContextSelector contextSelector; - private StaticLoggerBinder() { defaultLoggerContext.setName(CoreConstants.DEFAULT_CONTEXT_NAME); } public static StaticLoggerBinder getSingleton() { - return SINGLETON; + return SINGLETON; } - + /** * Package access for testing purposes. */ @@ -76,7 +75,7 @@ SINGLETON = new StaticLoggerBinder(); SINGLETON.init(); } - + /** * Package access for testing purposes. */ @@ -110,6 +109,21 @@ } } + /** + * Intantiate the context selector class designated by the user. The selector + * must have a constructor taking a LoggerContext instance as an argument. + * + * @param defaultLoggerContext + * @param contextSelectorStr + * @return an instance of the designated context selector class + * @throws ClassNotFoundException + * @throws SecurityException + * @throws NoSuchMethodException + * @throws IllegalArgumentException + * @throws InstantiationException + * @throws IllegalAccessException + * @throws InvocationTargetException + */ static ContextSelector dynamicalContextSelector( LoggerContext defaultLoggerContext, String contextSelectorStr) throws ClassNotFoundException, SecurityException, NoSuchMethodException, @@ -122,10 +136,10 @@ } public ILoggerFactory getLoggerFactory() { - if(!initialized) { + if (!initialized) { return defaultLoggerContext; } - + if (contextSelector == null) { throw new IllegalStateException( "contextSelector cannot be null. See also " + NULL_CS_URL); Modified: logback/trunk/logback-site/src/site/pages/manual/loggingSeparation.html ============================================================================== --- logback/trunk/logback-site/src/site/pages/manual/loggingSeparation.html (original) +++ logback/trunk/logback-site/src/site/pages/manual/loggingSeparation.html Sun Dec 28 21:22:44 2008 @@ -155,6 +155,12 @@ <p class="source">-Dlogback.ContextSelector=myPackage.myContextSelector</p> + <p>The context selector needs to implement the + <code>ContextSelector</code> interface and have a constructor + method admitting a <code>LoggerContext</code> instance as its only + parameter. + </p> + <h3>ContextJNDISelector</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 Sun Dec 28 21:22:44 2008 @@ -73,11 +73,21 @@ <code>JaninoEvaluator</code>. </p> + <p><code>ContextInitializer</code> will now print the url of the + configration it is using. This should help reduce confusion when + multiple config files are found on the class path. This change + resolves <a + href="http://jira.qos.ch/browse/LBCLASSIC-55">LBCLASSIC-55</a> + reported by Anton Tagunov and Henric Larsson. + </p> + <p><code>HTMLLayout</code> now honors custom conversion words, thus fixing <a href="http://jira.qos.ch/browse/LBCORE-74">LBCORE-74</a> as reported by Natan Cox.</p> + + <p>SMTPAppender im logback-classic now defaults to <code>OnErrorEvaluator</code> instead of a janino-based evaluator. Thus, by default <code>SMTPAppender</code> no longer