[logback-dev] svn commit: r1504 - in logback/trunk: logback-classic/src/main/java/ch/qos/logback/classic/util logback-site/src/site/pages logback-site/src/site/pages/manual

noreply.ceki at qos.ch noreply.ceki at qos.ch
Mon Apr 2 21:09:15 CEST 2007


Author: ceki
Date: Mon Apr  2 21:09:15 2007
New Revision: 1504

Modified:
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/util/ContextInitializer.java
   logback/trunk/logback-site/src/site/pages/manual/joran.html
   logback/trunk/logback-site/src/site/pages/news.html

Log:
- Fixed bug 54

Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/util/ContextInitializer.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/util/ContextInitializer.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/util/ContextInitializer.java	Mon Apr  2 21:09:15 2007
@@ -25,9 +25,9 @@
   }
 
   public static void autoConfig(LoggerContext loggerContext, ClassLoader classLoader) {
-    URL url = Loader.getResource(AUTOCONFIG_FILE, classLoader);
+    URL url = Loader.getResource(TEST_AUTOCONFIG_FILE, classLoader);
     if (url == null) {
-      url = Loader.getResource(TEST_AUTOCONFIG_FILE, classLoader);
+      url = Loader.getResource(AUTOCONFIG_FILE, classLoader);
     }
 
     if (url != null) {

Modified: logback/trunk/logback-site/src/site/pages/manual/joran.html
==============================================================================
--- logback/trunk/logback-site/src/site/pages/manual/joran.html	(original)
+++ logback/trunk/logback-site/src/site/pages/manual/joran.html	Mon Apr  2 21:09:15 2007
@@ -64,44 +64,48 @@
     logback follows to try to configure itself:
     </p>
 
-    xxxxxxxxxxxxx
 
-    <ul>
+
+    <ol>
       <li>
-        <p>Logback tries to find a file called <em>logback.xml</em>
-        within the classpath.</p>
+        <p>Logback tries to find a file called <em>logback-test.xml</em>
+        in the classpath.</p>
       </li>
 
-      <li><p>If no such file is found, it checks for another file
-      called <em>logback-test.xml</em>.</p>
+      <li><p>If no such file is found, it checks for the file
+      <em>logback.xml</em>.</p>
       </li>
       
-      <li><p>In case none of these files are found, logback configures
-      itself automatically using the <a
-      href="../xref/ch/qos/logback/classic/BasicConfigurator.html"><code>BasicConfigurator</code>
-      </a> class.</p>
+      <li><p>In case neither file is found, logback configures itself
+      automatically using the <a
+      href="../xref/ch/qos/logback/classic/BasicConfigurator.html"><code>BasicConfigurator</code></a>
+      which will direct logging output on the console. </a></p>
       </li>
-</ul>
-<p>
-The first two checks allow for two environments to cooperate nicely. When the application
-using logback is in development and test process, a special file can be used to setup
-a logging environment that is developer-friendly. Once in production environment, the 
-presence of a <em>logback.xml</em> file overrides any <em>logback-test.xml</em> 
-configuration.
-</p>
+    </ol>
 
-<p>
-The last step is meant to provide very basic logging functionnality in case no configuration
-file is provided. In that case, the logging requests are output to the console.
-</p>
+    <!-- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -->
 
-<h3>Automatically configuring logback</h3>
+    <p>The last step is meant to provide basic logging functionnality
+    in case no configuration file is provided. 
+    </p>
 
-<p>
-The simplest way to configure logback is by letting logback use its 
-<code>BasicConfigurator.configureDefaultContext()</code> method. Let us give a taste of how 
-this is done with the help of an imaginary application called <code>MyApp1</code>.
-</p>
+
+    <p>Assuming the <em>logback-test.xml</em> file is placed under
+    <em>src/test/resources</em> folder, Maven will ensure that it
+    won't be included in the artifact it produces. Thus, you can use a
+    different configuration file, namely <em>logback-test.xml</em>
+    during testing, and another file, namely, <em>logback.xml</em>, in
+    production.
+    </p>
+
+
+    <h3>Automatically configuring logback</h3>
+
+    <p>The simplest way to configure logback is by letting logback use
+    its <code>BasicConfigurator.configureDefaultContext()</code>
+    method. Let us give a taste of how this is done with the help of
+    an imaginary application called <code>MyApp1</code>.
+    </p>
 
 <em>Example 3.1: Simple example of <code>BasicConfigurator</code> usage 
 <a href="../xref/chapter3/MyApp1.html">(logback-examples/src/main/java/chapter3/MyApp1.java)</a></em>

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	Mon Apr  2 21:09:15 2007
@@ -63,6 +63,14 @@
   more details.
   </p>
 
+  <p>As discussed in <a href="">bug 54</a>, during automatic
+  initialization, it makes better sense to first check for
+  <em>logback-test.xml</em> file and only if that fails, to check for
+  <em>logback.xml</em>. Maven2 will guarantee that the
+  logback-test.xml file, if places undder test/resources will not be
+  included in the artifact it produces.
+  </p>
+
   <h3>March 20th, 2007 - Release of version 0.9.3</h3>
   
   <p>Includes in configuration files are now supported by Joran,



More information about the logback-dev mailing list