[logback-dev] svn commit: r895 - in logback/trunk: logback-examples/src/main/java/chapter4 logback-examples/src/main/java/chapter4/socket logback-site/src/site/xdocTemplates/manual
noreply.seb at qos.ch
noreply.seb at qos.ch
Fri Nov 10 18:32:04 CET 2006
Author: seb
Date: Fri Nov 10 18:32:03 2006
New Revision: 895
Modified:
logback/trunk/logback-examples/src/main/java/chapter4/ExitWoes1.java
logback/trunk/logback-examples/src/main/java/chapter4/ExitWoes2.java
logback/trunk/logback-examples/src/main/java/chapter4/socket/SocketClient1.java
logback/trunk/logback-examples/src/main/java/chapter4/socket/SocketClient2.java
logback/trunk/logback-site/src/site/xdocTemplates/manual/appenders.xml
Log:
corrected some imports. Unfortunately, we sometimes _have_ to import logback's logger
and not slf4j's logger class.
Modified: logback/trunk/logback-examples/src/main/java/chapter4/ExitWoes1.java
==============================================================================
--- logback/trunk/logback-examples/src/main/java/chapter4/ExitWoes1.java (original)
+++ logback/trunk/logback-examples/src/main/java/chapter4/ExitWoes1.java Fri Nov 10 18:32:03 2006
@@ -13,9 +13,9 @@
import java.io.OutputStream;
import java.io.OutputStreamWriter;
-import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.core.WriterAppender;
import ch.qos.logback.core.layout.EchoLayout;
@@ -33,6 +33,8 @@
writerAppender.setWriter(new OutputStreamWriter(os));
writerAppender.setImmediateFlush(false);
writerAppender.start();
+ Logger root = lc.getLogger(LoggerContext.ROOT_NAME);
+ root.addAppender(writerAppender);
Logger logger = lc.getLogger(ExitWoes1.class);
Modified: logback/trunk/logback-examples/src/main/java/chapter4/ExitWoes2.java
==============================================================================
--- logback/trunk/logback-examples/src/main/java/chapter4/ExitWoes2.java (original)
+++ logback/trunk/logback-examples/src/main/java/chapter4/ExitWoes2.java Fri Nov 10 18:32:03 2006
@@ -13,12 +13,13 @@
import java.io.OutputStream;
import java.io.OutputStreamWriter;
-import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.core.WriterAppender;
import ch.qos.logback.core.layout.EchoLayout;
+import ch.qos.logback.core.util.StatusPrinter;
public class ExitWoes2 {
@@ -33,11 +34,15 @@
writerAppender.setWriter(new OutputStreamWriter(os));
writerAppender.setImmediateFlush(false);
writerAppender.start();
+ Logger root = lc.getLogger(LoggerContext.ROOT_NAME);
+ root.addAppender(writerAppender);
Logger logger = lc.getLogger(ExitWoes2.class);
logger.debug("Hello world.");
lc.shutdownAndReset();
+
+ StatusPrinter.print(lc);
}
}
\ No newline at end of file
Modified: logback/trunk/logback-examples/src/main/java/chapter4/socket/SocketClient1.java
==============================================================================
--- logback/trunk/logback-examples/src/main/java/chapter4/socket/SocketClient1.java (original)
+++ logback/trunk/logback-examples/src/main/java/chapter4/socket/SocketClient1.java Fri Nov 10 18:32:03 2006
@@ -13,9 +13,9 @@
import java.io.BufferedReader;
import java.io.InputStreamReader;
-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.net.SocketAppender;
@@ -55,8 +55,8 @@
// of the next statement.
socketAppender.start();
- Logger logger = LoggerFactory.getLogger(SocketClient1.class);
- //logger.addAppender(socketAppender);
+ Logger logger = (Logger) LoggerFactory.getLogger(SocketClient1.class);
+ logger.addAppender(socketAppender);
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
Modified: logback/trunk/logback-examples/src/main/java/chapter4/socket/SocketClient2.java
==============================================================================
--- logback/trunk/logback-examples/src/main/java/chapter4/socket/SocketClient2.java (original)
+++ logback/trunk/logback-examples/src/main/java/chapter4/socket/SocketClient2.java Fri Nov 10 18:32:03 2006
@@ -28,7 +28,7 @@
public class SocketClient2 {
static void usage(String msg) {
System.err.println(msg);
- System.err.println("Usage: java " + SocketClient1.class.getName() +
+ System.err.println("Usage: java " + SocketClient2.class.getName() +
" configFile\n" +
" configFile a logback configuration file" +
" in XML format.");
Modified: logback/trunk/logback-site/src/site/xdocTemplates/manual/appenders.xml
==============================================================================
--- logback/trunk/logback-site/src/site/xdocTemplates/manual/appenders.xml (original)
+++ logback/trunk/logback-site/src/site/xdocTemplates/manual/appenders.xml Fri Nov 10 18:32:03 2006
@@ -1377,6 +1377,7 @@
<RemoteHost>${host}</RemoteHost>
<Port>${port}</Port>
<ReconnectionDelay>10000</ReconnectionDelay>
+ <IncludeCallerData>${includeCallerData}</IncludeCallerData>
</appender>
<root>
More information about the logback-dev
mailing list