[logback-dev] [GIT] Logback: the generic, reliable, fast and flexible logging framework. branch, encoder, updated. v0.9.18-49-g4577cf0
added by portage for gitosis-gentoo
git-noreply at pixie.qos.ch
Sat Feb 27 10:25:12 CET 2010
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Logback: the generic, reliable, fast and flexible logging framework.".
The branch, encoder has been updated
via 4577cf0a7f55e1162d72691951476d9ae876f0f1 (commit)
from b6bb584c8cb7ff7e6ebf9a0eefcfec48f5a8418c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=4577cf0a7f55e1162d72691951476d9ae876f0f1
http://github.com/ceki/logback/commit/4577cf0a7f55e1162d72691951476d9ae876f0f1
commit 4577cf0a7f55e1162d72691951476d9ae876f0f1
Author: Ceki Gulcu <ceki at qos.ch>
Date: Sat Feb 27 10:24:34 2010 +0100
ConsoleAppender must keep the underlying stream open.
The console is not ours to close.
diff --git a/logback-core/src/main/java/ch/qos/logback/core/ConsoleAppender.java b/logback-core/src/main/java/ch/qos/logback/core/ConsoleAppender.java
index 2939510..ccc7cbb 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/ConsoleAppender.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/ConsoleAppender.java
@@ -13,10 +13,6 @@
*/
package ch.qos.logback.core;
-import java.io.IOException;
-import java.io.OutputStream;
-
-import ch.qos.logback.core.status.ErrorStatus;
import ch.qos.logback.core.status.Status;
import ch.qos.logback.core.status.WarnStatus;
@@ -89,12 +85,11 @@ public class ConsoleAppender<E> extends OutputStreamAppender<E> {
* This method overrides the parent {@link OutputStreamAppender#closeOutputStream}
* implementation because the console stream is not ours to close.
*/
-// @Override
-// protected final void closeOutputStream() {
-// encoderClose();
-// }
+ @Override
+ protected final void closeOutputStream() {
+ encoderClose();
+ }
- xxxxxxxxxx
}
diff --git a/logback-core/src/test/java/ch/qos/logback/core/appender/ConsoleAppenderTest.java b/logback-core/src/test/java/ch/qos/logback/core/appender/ConsoleAppenderTest.java
index 2f98da8..bce6931 100644
--- a/logback-core/src/test/java/ch/qos/logback/core/appender/ConsoleAppenderTest.java
+++ b/logback-core/src/test/java/ch/qos/logback/core/appender/ConsoleAppenderTest.java
@@ -14,6 +14,7 @@
package ch.qos.logback.core.appender;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
@@ -28,12 +29,11 @@ import ch.qos.logback.core.CoreConstants;
import ch.qos.logback.core.encoder.DummyEncoder;
import ch.qos.logback.core.encoder.NopEncoder;
import ch.qos.logback.core.layout.DummyLayout;
-import ch.qos.logback.core.util.TeeOutputStream;
public class ConsoleAppenderTest extends AbstractAppenderTest<Object> {
- TeeOutputStream tee;
+ XTeeOutputStream tee;
PrintStream original;
@@ -46,7 +46,7 @@ public class ConsoleAppenderTest extends AbstractAppenderTest<Object> {
// tee = new TeeOutputStream(original);
// keep the console quiet
- tee = new TeeOutputStream(null);
+ tee = new XTeeOutputStream(null);
// redirect System.out to tee
System.setOut(new PrintStream(tee));
@@ -99,6 +99,9 @@ public class ConsoleAppenderTest extends AbstractAppenderTest<Object> {
ca.start();
ca.doAppend(new Object());
ca.stop();
+ // ConsoleAppender must keep the underlying stream open.
+ // The console is not ours to close.
+ assertFalse(tee.isClosed());
assertEquals(DummyLayout.DUMMY + "CLOSED", tee.toString());
}
@@ -113,7 +116,6 @@ public class ConsoleAppenderTest extends AbstractAppenderTest<Object> {
ca.setEncoder(dummyEncoder);
ca.start();
ca.doAppend(new Object());
-
assertEquals(DummyLayout.DUMMY, new String(tee.toByteArray(), encodingName));
}
diff --git a/logback-core/src/test/java/ch/qos/logback/core/appender/XTeeOutputStream.java b/logback-core/src/test/java/ch/qos/logback/core/appender/XTeeOutputStream.java
new file mode 100644
index 0000000..bc707a2
--- /dev/null
+++ b/logback-core/src/test/java/ch/qos/logback/core/appender/XTeeOutputStream.java
@@ -0,0 +1,25 @@
+package ch.qos.logback.core.appender;
+
+import java.io.IOException;
+import java.io.PrintStream;
+
+import ch.qos.logback.core.util.TeeOutputStream;
+
+public class XTeeOutputStream extends TeeOutputStream {
+
+ boolean closed = false;
+ public XTeeOutputStream(PrintStream targetPS) {
+ super(targetPS);
+ }
+
+ @Override
+ public void close() throws IOException {
+ closed = true;
+ super.close();
+ }
+
+
+ public boolean isClosed() {
+ return closed;
+ }
+}
-----------------------------------------------------------------------
Summary of changes:
.../java/ch/qos/logback/core/ConsoleAppender.java | 13 +++-------
.../logback/core/appender/ConsoleAppenderTest.java | 10 ++++---
.../logback/core/appender/XTeeOutputStream.java | 25 ++++++++++++++++++++
3 files changed, 35 insertions(+), 13 deletions(-)
create mode 100644 logback-core/src/test/java/ch/qos/logback/core/appender/XTeeOutputStream.java
hooks/post-receive
--
Logback: the generic, reliable, fast and flexible logging framework.
More information about the logback-dev
mailing list