[logback-dev] svn commit: r814 - in logback/trunk: logback-examples/src/main/java/chapter5 logback-site/src/site/xdocTemplates/manual

noreply.seb at qos.ch noreply.seb at qos.ch
Mon Oct 30 11:58:33 CET 2006


Author: seb
Date: Mon Oct 30 11:58:32 2006
New Revision: 814

Modified:
   logback/trunk/logback-examples/src/main/java/chapter5/CallerEvaluatorExample.java
   logback/trunk/logback-examples/src/main/java/chapter5/ExceptionEvaluatorExample.java
   logback/trunk/logback-examples/src/main/java/chapter5/GoMDC.java
   logback/trunk/logback-examples/src/main/java/chapter5/SampleLogging.java
   logback/trunk/logback-site/src/site/xdocTemplates/manual/layouts.xml

Log:
changed imports where possible

Modified: logback/trunk/logback-examples/src/main/java/chapter5/CallerEvaluatorExample.java
==============================================================================
--- logback/trunk/logback-examples/src/main/java/chapter5/CallerEvaluatorExample.java	(original)
+++ logback/trunk/logback-examples/src/main/java/chapter5/CallerEvaluatorExample.java	Mon Oct 30 11:58:32 2006
@@ -1,8 +1,8 @@
 package chapter5;
 
+import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import ch.qos.logback.classic.Logger;
 import ch.qos.logback.classic.LoggerContext;
 import ch.qos.logback.classic.joran.JoranConfigurator;
 import ch.qos.logback.core.joran.spi.JoranException;
@@ -11,7 +11,7 @@
 public class CallerEvaluatorExample {
 
   public static void main(String[] args)  {
-    Logger logger = (Logger) LoggerFactory
+    Logger logger = LoggerFactory
         .getLogger(CallerEvaluatorExample.class);
     LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
 

Modified: logback/trunk/logback-examples/src/main/java/chapter5/ExceptionEvaluatorExample.java
==============================================================================
--- logback/trunk/logback-examples/src/main/java/chapter5/ExceptionEvaluatorExample.java	(original)
+++ logback/trunk/logback-examples/src/main/java/chapter5/ExceptionEvaluatorExample.java	Mon Oct 30 11:58:32 2006
@@ -1,8 +1,8 @@
 package chapter5;
 
+import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import ch.qos.logback.classic.Logger;
 import ch.qos.logback.classic.LoggerContext;
 import ch.qos.logback.classic.joran.JoranConfigurator;
 import ch.qos.logback.core.joran.spi.JoranException;
@@ -11,8 +11,7 @@
 public class ExceptionEvaluatorExample {
 
   public static void main(String[] args) {
-    Logger logger = (Logger) LoggerFactory
-        .getLogger(ExceptionEvaluatorExample.class);
+    Logger logger = LoggerFactory.getLogger(ExceptionEvaluatorExample.class);
     LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
 
     try {
@@ -30,7 +29,5 @@
         logger.debug("logging statement " + i, new Exception("display"));
       }
     }
-
-    StatusPrinter.print(lc);
   }
 }
\ No newline at end of file

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	Mon Oct 30 11:58:32 2006
@@ -1,8 +1,8 @@
 package chapter5;
 
+import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import ch.qos.logback.classic.Logger;
 import ch.qos.logback.classic.LoggerContext;
 import ch.qos.logback.classic.MDC;
 import ch.qos.logback.classic.joran.JoranConfigurator;
@@ -12,7 +12,7 @@
 public class GoMDC {
 
   public static void main(String[] args)  {
-    Logger logger = (Logger) LoggerFactory
+    Logger logger = LoggerFactory
         .getLogger(GoMDC.class);
     LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
 

Modified: logback/trunk/logback-examples/src/main/java/chapter5/SampleLogging.java
==============================================================================
--- logback/trunk/logback-examples/src/main/java/chapter5/SampleLogging.java	(original)
+++ logback/trunk/logback-examples/src/main/java/chapter5/SampleLogging.java	Mon Oct 30 11:58:32 2006
@@ -11,6 +11,7 @@
 public class SampleLogging {
 
   public static void main(String[] args) {
+
     Logger logger = LoggerFactory.getLogger(SampleLogging.class);
     LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
 

Modified: logback/trunk/logback-site/src/site/xdocTemplates/manual/layouts.xml
==============================================================================
--- logback/trunk/logback-site/src/site/xdocTemplates/manual/layouts.xml	(original)
+++ logback/trunk/logback-site/src/site/xdocTemplates/manual/layouts.xml	Mon Oct 30 11:58:32 2006
@@ -335,8 +335,7 @@
 public class PatternSample {
 
   static public void main(String[] args) throws Exception {
-    Logger rootLogger = (Logger)
-    LoggerFactory.getLogger("root");
+    Logger rootLogger = (Logger)LoggerFactory.getLogger("root");
 
     <b>PatternLayout layout = new PatternLayout();
     layout.setPattern("%-5level [%thread]: %message%n");
@@ -1040,13 +1039,22 @@
 		<p>Let us test this configuration with the following code.</p>
 		<em>
 			Example 5.2: Sample usage of EventEvaluators
-			(logback-examples/src/main/java/chapter5/EventEvaluatorExample.java)
+			(logback-examples/src/main/java/chapter5/CallerEvaluatorExample.java)
 		</em>
-		<div class="source"><pre>public class CallerEvaluatorExample {
+		<div class="source"><pre>ppackage chapter5;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+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.util.StatusPrinter;
+
+public class CallerEvaluatorExample {
 
   public static void main(String[] args)  {
-    Logger logger = (Logger) LoggerFactory
-        .getLogger(CallerEvaluatorExample.class);
+    Logger logger = LoggerFactory.getLogger(CallerEvaluatorExample.class);
     LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
 
     try {
@@ -1057,13 +1065,13 @@
       StatusPrinter.print(lc);
     }
 
-    <b>for (int i = 0; i &lt; 5; i++) {
+    for (int i = 0; i &lt; 5; i++) {
       if (i == 3) {
         logger.debug("who calls thee?");
       } else {
         logger.debug("I know me " + i);
       }
-    }</b>
+    }
   }
 }</pre></div>
 		<p>
@@ -1081,13 +1089,13 @@
 			<code>EventEvaluatorExample</code>
 			class.
 		</p>
-		<div class="source"><pre>0    [main] DEBUG - logging statement0 
-0    [main] DEBUG - logging statement1 
-0    [main] DEBUG - logging statement2 
-0    [main] DEBUG - stacktrace logging statement3 
+		<div class="source"><pre>0    [main] DEBUG - I know me 0 
+0    [main] DEBUG - I know me 1 
+0    [main] DEBUG - I know me 2 
+0    [main] DEBUG - who calls thee? 
 Caller+0   at chapter5.CallerEvaluatorExample.main(CallerEvaluatorExample.java:28)
 
-0    [main] DEBUG - logging statement4</pre></div>
+0    [main] DEBUG - I know me 4</pre></div>
 
 		<p>
 			Of course, one can change the expression to match a real
@@ -1107,11 +1115,20 @@
 		with an exception. However, we do not want to have the stack trace of the
 		third request to be output.</p>
 
-<div class="source"><pre>public class ExceptionEvaluatorExample {
+<div class="source"><pre>package chapter5;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+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.util.StatusPrinter;
+
+public class ExceptionEvaluatorExample {
 
   public static void main(String[] args) {
-    Logger logger = (Logger) LoggerFactory
-        .getLogger(ExceptionEvaluatorExample.class);
+    Logger logger = LoggerFactory.getLogger(ExceptionEvaluatorExample.class);
     LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
 
     try {
@@ -1121,14 +1138,14 @@
     } catch (JoranException je) {
       StatusPrinter.print(lc);
     }
-    <b>for (int i = 0; i &lt; 5; i++) {
+    for (int i = 0; i &lt; 5; i++) {
       if (i == 3) {
         logger.debug("logging statement " + i, new TestException(
             "do not display this"));
       } else {
         logger.debug("logging statement " + i, new Exception("display"));
       }
-    }</b>
+    }
   }
 }</pre></div>
 		



More information about the logback-dev mailing list