[logback-dev] svn commit: r1557 - in logback/trunk: . logback-examples/src/main/java/chapter4 logback-examples/src/main/java/chapter5 logback-examples/src/main/java/chapter6 logback-examples/src/main/java/chapter7 logback-site/src/site/pages logback-site/src/site/pages/manual

noreply.ceki at qos.ch noreply.ceki at qos.ch
Thu Jul 12 22:47:16 CEST 2007


Author: ceki
Date: Thu Jul 12 22:47:16 2007
New Revision: 1557

Modified:
   logback/trunk/   (props changed)
   logback/trunk/logback-examples/src/main/java/chapter4/ConfigurationTester.java
   logback/trunk/logback-examples/src/main/java/chapter5/GoMDC.java
   logback/trunk/logback-examples/src/main/java/chapter6/FilterEvents.java
   logback/trunk/logback-examples/src/main/java/chapter7/NumberCruncherServer.java
   logback/trunk/logback-examples/src/main/java/chapter7/SimpleMDC.java
   logback/trunk/logback-examples/src/main/java/chapter7/UserServletFilter.java
   logback/trunk/logback-site/src/site/pages/bridge.html
   logback/trunk/logback-site/src/site/pages/manual/layouts.html
   logback/trunk/logback-site/src/site/pages/manual/mdc.html
   logback/trunk/pom.xml

Log:
aligning with MDC support in SLF4J

Modified: logback/trunk/logback-examples/src/main/java/chapter4/ConfigurationTester.java
==============================================================================
--- logback/trunk/logback-examples/src/main/java/chapter4/ConfigurationTester.java	(original)
+++ logback/trunk/logback-examples/src/main/java/chapter4/ConfigurationTester.java	Thu Jul 12 22:47:16 2007
@@ -2,10 +2,9 @@
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
+import org.slf4j.MDC;
 
 import ch.qos.logback.classic.LoggerContext;
-import ch.qos.logback.classic.MDC;
 import ch.qos.logback.classic.joran.JoranConfigurator;
 import ch.qos.logback.core.joran.spi.JoranException;
 import ch.qos.logback.core.util.StatusPrinter;

Modified: logback/trunk/logback-examples/src/main/java/chapter5/GoMDC.java
==============================================================================
--- logback/trunk/logback-examples/src/main/java/chapter5/GoMDC.java	(original)
+++ logback/trunk/logback-examples/src/main/java/chapter5/GoMDC.java	Thu Jul 12 22:47:16 2007
@@ -2,9 +2,9 @@
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
 
 import ch.qos.logback.classic.LoggerContext;
-import ch.qos.logback.classic.MDC;
 import ch.qos.logback.classic.joran.JoranConfigurator;
 import ch.qos.logback.core.joran.spi.JoranException;
 import ch.qos.logback.core.util.StatusPrinter;

Modified: logback/trunk/logback-examples/src/main/java/chapter6/FilterEvents.java
==============================================================================
--- logback/trunk/logback-examples/src/main/java/chapter6/FilterEvents.java	(original)
+++ logback/trunk/logback-examples/src/main/java/chapter6/FilterEvents.java	Thu Jul 12 22:47:16 2007
@@ -2,11 +2,11 @@
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
 import org.slf4j.Marker;
 import org.slf4j.MarkerFactory;
 
 import ch.qos.logback.classic.LoggerContext;
-import ch.qos.logback.classic.MDC;
 import ch.qos.logback.classic.joran.JoranConfigurator;
 import ch.qos.logback.core.joran.spi.JoranException;
 

Modified: logback/trunk/logback-examples/src/main/java/chapter7/NumberCruncherServer.java
==============================================================================
--- logback/trunk/logback-examples/src/main/java/chapter7/NumberCruncherServer.java	(original)
+++ logback/trunk/logback-examples/src/main/java/chapter7/NumberCruncherServer.java	Thu Jul 12 22:47:16 2007
@@ -18,9 +18,9 @@
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
 
 import ch.qos.logback.classic.LoggerContext;
-import ch.qos.logback.classic.MDC;
 import ch.qos.logback.classic.joran.JoranConfigurator;
 import ch.qos.logback.core.joran.spi.JoranException;
 

Modified: logback/trunk/logback-examples/src/main/java/chapter7/SimpleMDC.java
==============================================================================
--- logback/trunk/logback-examples/src/main/java/chapter7/SimpleMDC.java	(original)
+++ logback/trunk/logback-examples/src/main/java/chapter7/SimpleMDC.java	Thu Jul 12 22:47:16 2007
@@ -11,9 +11,9 @@
 package chapter7;
 
 import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
 
 import ch.qos.logback.classic.Logger;
-import ch.qos.logback.classic.MDC;
 import ch.qos.logback.classic.PatternLayout;
 import ch.qos.logback.classic.spi.LoggingEvent;
 import ch.qos.logback.core.ConsoleAppender;

Modified: logback/trunk/logback-examples/src/main/java/chapter7/UserServletFilter.java
==============================================================================
--- logback/trunk/logback-examples/src/main/java/chapter7/UserServletFilter.java	(original)
+++ logback/trunk/logback-examples/src/main/java/chapter7/UserServletFilter.java	Thu Jul 12 22:47:16 2007
@@ -22,7 +22,7 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpSession;
 
-import ch.qos.logback.classic.MDC;
+import org.slf4j.MDC;
 
 /**
  * A simple servlet filter that puts the username

Modified: logback/trunk/logback-site/src/site/pages/bridge.html
==============================================================================
--- logback/trunk/logback-site/src/site/pages/bridge.html	(original)
+++ logback/trunk/logback-site/src/site/pages/bridge.html	Thu Jul 12 22:47:16 2007
@@ -23,92 +23,10 @@
 	
     <h2>Log4j bridge</h2>
     
-    <p>Recent versions of logback ship with a module called
-    <em>log4j-bridge</em>.  It allows log4j users to use logback
-    without changing <em>a single line of code</em> in their existing
-    applications by replacing the <em>log4j.jar</em> file with
-    appropriate jars, as described below.
+    <p>This module has migrated into the SLF4J project, its original
+    home. It has also been renamed as <a
+    href="http://www.slf4j.org/log4j-over-slf4j.html">log4j-over-slf4j</a>.
     </p>
-    
-    <h3>How does it work?</h3>
-
-    <p>The log4j-bridge module contains replacements of most widely
-    used log4j classes, namely <code>org.apache.log4j.Category</code>,
-    <code>org.apache.log4j.Logger</code>,
-    <code>org.apache.log4j.Priority</code>,
-    <code>org.apache.log4j.Level</code>,
-    <code>org.apache.log4j.MDC</code>, and
-    <code>org.apache.log4j.BasicConfigurator</code>. These replacement
-    classes redirect all work to their corresponding logback classes.
-    </p>
-
-    <p>
-			To use log4j-bridge in your own application, the first step is
-			to locate and then remove <em>log4j.jar</em> replacing it with
-			<em>log4j-bridge.jar</em> which ships with logback. Note that
-			you still need logback-classic and its dependencies for the
-			log4j-bridge to work properly. In summary, here is a list of the
-			required jars:
-		</p>
-
-		<ul>
-			<li>
-				log4j-bridge-<em>VERSION</em>.jar
-			</li>
-			<li>
-				logback-classic-<em>VERSION</em>.jar
-			</li>
-			<li>
-				logback-core-<em>VERSION</em>.jar
-			</li>
-			<li>
-				slf4j-api-<em>VERSION</em>.jar
-			</li>
-		</ul>
-		
-		<p>
-			In most situtations, replacing a jar file is all it takes in
-			order to migrate from log4j to logback.
-    </p>
-
-    <p>Note that as a result of this migration, log4j configuration
-    files will no longer be picked up. If you need to migrate your
-    log4j.properties file to logback, the <a
-    href="http://logback.qos.ch/translator/">log4j translator</a>
-    might be of help. For configuring logback, please refer to <a
-    href="manual/index.html">the manual</a>.
-    </p>
-
-    <p>We are happy to report that several applications are
-    successfully using log4j-bridge in production.
-    </p>
-
-
-    <h3>When does it not work?</h3>
-    
-    <p>The <em>log4-bridge</em> module will not work when the
-    application calls log4j components that are not present in the
-    bridge.  For example, direct references to log4j appenders,
-    filters or PropertyConfigurator are not supported by log4j-bridge.
-    While the number of cases where log4j-bridge is insufficient is
-    not completely negligible, in a vast majority of cases where log4j
-    is configured through a configuration file, be it
-    <em>log4j.properties</em> or <em>log4j.xml</em>, log4j-bridge is
-    enough in order to migrate youran application to logback.
-    </p>
-
-    <h3>What about the overhead?</h3>
-
-    <p>There overhead of using log4j-bridge instead of log4j directly
-    is relatively small. Given that log4j-bridge immediately delegates
-    all work to logback, the CPU overhead should be negligible, in the
-    order of a few <em>nanoseconds</em>. There is a memory overhead
-    corresponding to an entry in a hasmap per logger, which should be
-    usually acceptable even for very large applications consisting of
-    several thousand loggers.  Moreover, given that logback is both
-    much faster and more memory-efficient, the gains made by using
-    logback should compensate for the overhead of using log4j-bridge
-    instead of log4j directly.</p>
 	
 	
 <script src="templates/footer.js"></script>

Modified: logback/trunk/logback-site/src/site/pages/manual/layouts.html
==============================================================================
--- logback/trunk/logback-site/src/site/pages/manual/layouts.html	(original)
+++ logback/trunk/logback-site/src/site/pages/manual/layouts.html	Thu Jul 12 22:47:16 2007
@@ -1238,7 +1238,7 @@
 		specifier, the stack trace is displayed when <em>the expression
 		evaluates to <b>false</b>.</em></p>
 		
-		<h3>Creating a custom conversion specifier</h3>
+		<h2>Creating a custom conversion specifier</h2>
 
 		<p>Up to this point we have presented the built-inconversion
 		specifiers of <code>PatternLayout</code>. But it is also possible

Modified: logback/trunk/logback-site/src/site/pages/manual/mdc.html
==============================================================================
--- logback/trunk/logback-site/src/site/pages/manual/mdc.html	(original)
+++ logback/trunk/logback-site/src/site/pages/manual/mdc.html	Thu Jul 12 22:47:16 2007
@@ -48,18 +48,19 @@
    	method in the book <em>Patterns for Logging Diagnostic
    	Messages</em> in Pattern Languages of Program Design 3, edited by
    	R. Martin, D. Riehle, and F. Buschmann (Addison-Wesley,
-   	1997). Logback offers a variant of this technique: Mapped
-   	Diagnostic Contexts (MDC).
+   	1997). Logback leverages a variant of this technique includde in
+   	the SLF4J API: Mapped Diagnostic Contexts (MDC).
 		</p>
 		
 		<p>
-			To uniquely stamp each request, the user puts contextual information into the 
-			<code><a href="../xref/ch/qos/logback/classic/MDC.html">MDC</a></code>, 
-			the abbreviation of Mapped Diagnostic Context. 
-			The public interface of the MDC class is shown below. 
+			To uniquely stamp each request, the user puts contextual
+			information into the <code><a
+			href="http://www.slf4j.org/api/org/slf4j/MDC.html">MDC</a></code>,
+			the abbreviation of Mapped Diagnostic Context.  The public
+			interface of the MDC class is shown below.
 		</p>
 
-<div class="source"><pre>package ch.qos.logback.classic;
+<div class="source"><pre>package org.slf4j;
 
 public class MDC {
   //Put a context value as identified by <em>key</em>
@@ -79,16 +80,17 @@
   <b>public static Set&lt;String> getKeys();</b>
 }</pre></div>
 
-		<p>
-			The <code>MDC</code> class contains only static methods. 
-			It lets the developer place information in a <em>diagnostic context</em> that can be 
-			subsequently retrieved by certain logback components. The 
-			<code>MDC</code> manages contextual information on a <em>per thread basis</em>.  
-			Typically, while starting to service a new client request, the developer will 
-			insert pertinent contextual information, such as the client id, client's IP 
-			address, request parameters etc. into the <code>MDC</code>. Logback components, 
-			if appropriately configured, will automatically include this information 
-			in each log entry.
+		<p>The <code>MDC</code> class contains only static methods.  It
+			lets the developer place information in a <em>diagnostic
+			context</em> that can be subsequently retrieved by certain
+			logback components. The <code>MDC</code> manages contextual
+			information on a <em>per thread basis</em>.  Typically, while
+			starting to service a new client request, the developer will
+			insert pertinent contextual information, such as the client id,
+			client's IP address, request parameters etc. into the
+			<code>MDC</code>. Logback components, if appropriately
+			configured, will automatically include this information in each
+			log entry.
 		</p>
 
 		<p>
@@ -101,6 +103,7 @@
 <div class="source"><pre>package chapter7;
 
 import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
 
 import ch.qos.logback.classic.Logger;
 import ch.qos.logback.classic.MDC;
@@ -233,9 +236,9 @@
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
 
 import ch.qos.logback.classic.LoggerContext;
-import ch.qos.logback.classic.MDC;
 import ch.qos.logback.classic.joran.JoranConfigurator;
 import ch.qos.logback.core.joran.spi.JoranException;
 
@@ -532,7 +535,7 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpSession;
 
-import ch.qos.logback.classic.MDC;
+import org.slf4j.MDC;
 
 public class UserServletFilter implements Filter {
 

Modified: logback/trunk/pom.xml
==============================================================================
--- logback/trunk/pom.xml	(original)
+++ logback/trunk/pom.xml	Thu Jul 12 22:47:16 2007
@@ -36,7 +36,7 @@
   
   <properties>
     <!-- slf4j.version property is used below and in setClasspath.cmd -->
-    <slf4j.version>1.4.2-SNAPSHOT</slf4j.version>  
+    <slf4j.version>1.4.2</slf4j.version>  
     <consolePlugin.version>1.0.1</consolePlugin.version>  
     <retrotranslator.verify>false</retrotranslator.verify>
   </properties>



More information about the logback-dev mailing list