[GIT] Logback: the generic, reliable, fast and flexible logging framework. branch, master, updated. v0.9.18-103-g66fb732

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, master has been updated via 66fb7325add00aea9f037fc9e813f07df4648518 (commit) from 0805c91cc85c6a36c38024e637f2aa2fe3b09a03 (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=66fb7325add00aea9f037fc9e... http://github.com/ceki/logback/commit/66fb7325add00aea9f037fc9e813f07df46485... commit 66fb7325add00aea9f037fc9e813f07df4648518 Author: Ceki Gulcu <ceki@qos.ch> Date: Fri Mar 19 15:34:32 2010 +0100 Fixes http://jira.qos.ch/browse/LBCLASSIC-196 diff --git a/logback-classic/src/test/input/joran/compatibility/layoutInsteadOfEncoder.xml b/logback-classic/src/test/input/joran/compatibility/layoutInsteadOfEncoder.xml index a50b1da..283ed0b 100644 --- a/logback-classic/src/test/input/joran/compatibility/layoutInsteadOfEncoder.xml +++ b/logback-classic/src/test/input/joran/compatibility/layoutInsteadOfEncoder.xml @@ -1,6 +1,6 @@ <configuration> - <appender name="FILE" class="ch.qos.logback.core.FileAppender"> + <appender name="LIOE" class="ch.qos.logback.core.FileAppender"> <file>target/test-output/layoutInsteadOfEncoder.log</file> <append>true</append> @@ -10,6 +10,6 @@ </appender> <root level="debug"> - <appender-ref ref="FILE" /> + <appender-ref ref="LIOE" /> </root> </configuration> \ No newline at end of file diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/encoder/LayoutInsteadOfEncoderTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/encoder/LayoutInsteadOfEncoderTest.java index f19db29..250c601 100644 --- a/logback-classic/src/test/java/ch/qos/logback/classic/encoder/LayoutInsteadOfEncoderTest.java +++ b/logback-classic/src/test/java/ch/qos/logback/classic/encoder/LayoutInsteadOfEncoderTest.java @@ -1,14 +1,18 @@ package ch.qos.logback.classic.encoder; import static ch.qos.logback.core.CoreConstants.CODES_URL; -import static org.junit.Assert.*; +import static org.junit.Assert.assertTrue; import org.junit.Before; import org.junit.Test; +import org.slf4j.Logger; import ch.qos.logback.classic.ClassicTestConstants; import ch.qos.logback.classic.LoggerContext; import ch.qos.logback.classic.joran.JoranConfigurator; +import ch.qos.logback.classic.spi.ILoggingEvent; +import ch.qos.logback.core.FileAppender; +import ch.qos.logback.core.encoder.LayoutWrappingEncoder; import ch.qos.logback.core.joran.spi.JoranException; import ch.qos.logback.core.status.Status; import ch.qos.logback.core.status.StatusChecker; @@ -34,7 +38,14 @@ public class LayoutInsteadOfEncoderTest { + "compatibility/layoutInsteadOfEncoder.xml"); StatusPrinter.print(loggerContext); StatusChecker checker = new StatusChecker(loggerContext); - assertTrue(checker.containsMatch(Status.ERROR, "This appender no longer admits a layout as a sub-component")); - assertTrue(checker.containsMatch(Status.ERROR, "See also "+CODES_URL+"#layoutInsteadOfEncoder for details")); + assertTrue(checker.containsMatch(Status.WARN, "This appender no longer admits a layout as a sub-component")); + assertTrue(checker.containsMatch(Status.WARN, "See also "+CODES_URL+"#layoutInsteadOfEncoder for details")); + + ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger) loggerContext.getLogger(Logger.ROOT_LOGGER_NAME); + FileAppender<ILoggingEvent> fileAppender = (FileAppender<ILoggingEvent>) root.getAppender("LIOE"); + assertTrue(fileAppender.isStarted()); + + LayoutWrappingEncoder<ILoggingEvent> lwe = (LayoutWrappingEncoder<ILoggingEvent>) fileAppender.getEncoder(); + } } diff --git a/logback-core/src/main/java/ch/qos/logback/core/OutputStreamAppender.java b/logback-core/src/main/java/ch/qos/logback/core/OutputStreamAppender.java index 373a917..0ba51b4 100644 --- a/logback-core/src/main/java/ch/qos/logback/core/OutputStreamAppender.java +++ b/logback-core/src/main/java/ch/qos/logback/core/OutputStreamAppender.java @@ -13,13 +13,15 @@ */ package ch.qos.logback.core; +import static ch.qos.logback.core.CoreConstants.CODES_URL; + import java.io.IOException; import java.io.OutputStream; import ch.qos.logback.core.encoder.Encoder; +import ch.qos.logback.core.encoder.LayoutWrappingEncoder; import ch.qos.logback.core.spi.DeferredProcessingAware; import ch.qos.logback.core.status.ErrorStatus; -import static ch.qos.logback.core.CoreConstants.CODES_URL; /** * OutputStreamAppender appends events to a {@link OutputStream}. This class @@ -87,9 +89,14 @@ public class OutputStreamAppender<E> extends UnsynchronizedAppenderBase<E> { } } - public void setLayout(Layout layout) { - addError("This appender no longer admits a layout as a sub-component, set an encoder instead."); - addError("See also "+CODES_URL+"#layoutInsteadOfEncoder for details"); + public void setLayout(Layout<E> layout) { + addWarn("This appender no longer admits a layout as a sub-component, set an encoder instead."); + addWarn("To ensure compatibility, wrapping your layout in LayoutWrappingEncoder."); + addWarn("See also "+CODES_URL+"#layoutInsteadOfEncoder for details"); + LayoutWrappingEncoder<E> lwe = new LayoutWrappingEncoder<E>(); + lwe.setLayout(layout); + lwe.setContext(context); + this.encoder = lwe; } @Override @@ -223,5 +230,5 @@ public class OutputStreamAppender<E> extends UnsynchronizedAppenderBase<E> { public void setEncoder(Encoder<E> encoder) { this.encoder = encoder; } - + } 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 a4e5063..19c8afa 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 @@ -32,7 +32,6 @@ import ch.qos.logback.core.encoder.NopEncoder; import ch.qos.logback.core.layout.DummyLayout; import ch.qos.logback.core.status.Status; import ch.qos.logback.core.status.StatusChecker; -import ch.qos.logback.core.util.StatusPrinter; public class ConsoleAppenderTest extends AbstractAppenderTest<Object> { diff --git a/logback-site/src/site/pages/codes.html b/logback-site/src/site/pages/codes.html index 3ab510d..6ca3d07 100644 --- a/logback-site/src/site/pages/codes.html +++ b/logback-site/src/site/pages/codes.html @@ -59,17 +59,17 @@ <p>In practical terms, this means that configuration files need to be changed</p> - <p class="red bold">from (BAD)</p> + <p class="red bold">from (DEPRECATED)</p> <pre class="prettyprint source"><appender name="FILE" class="ch.qos.logback.core.FileAppender"> <file>testFile.log</file> ... <layout class="ch.qos.logback.classic.PatternLayout"> - <pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</pattern> + <pattern>%msg%n</pattern> </layout> </appender> </pre> - <p class="red bold">or the shorter equivalent (BAD)</p> + <p class="red bold">or the shorter equivalent (DEPRECATED)</p> <pre class="prettyprint source"><appender name="FILE" class="ch.qos.logback.core.FileAppender"> <file>testFile.log</file> @@ -105,7 +105,11 @@ <p>We hope to make up for this inconvenience with cool new features - which are only possible using encoders.</p> + which are only possible using encoders. <b>During a transition + period, layouts passed as parameter will be automatically wrapped by + an encoder so that configuration files in the old format (using a + layout instead of encoder) will continue to work unmodifed.</b> + </p> <hr/> diff --git a/logback-site/src/site/pages/news.html b/logback-site/src/site/pages/news.html index 644d52a..912666c 100644 --- a/logback-site/src/site/pages/news.html +++ b/logback-site/src/site/pages/news.html @@ -53,7 +53,10 @@ href="codes.html#layoutInsteadOfEncoder"> modifications to existing configuration files</a>. We hope to make up for this inconvenience with cool new features which are only possible using - encoders. + encoders. <b>During a transition period, layouts passed as + parameter will be automatically wrapped by an encoder so that + configuration files in the old format (using a layout instead of + encoder) will continue to work unmodifed.</b> </p> </div> ----------------------------------------------------------------------- Summary of changes: .../joran/compatibility/layoutInsteadOfEncoder.xml | 4 ++-- .../encoder/LayoutInsteadOfEncoderTest.java | 17 ++++++++++++++--- .../ch/qos/logback/core/OutputStreamAppender.java | 17 ++++++++++++----- .../logback/core/appender/ConsoleAppenderTest.java | 1 - logback-site/src/site/pages/codes.html | 12 ++++++++---- logback-site/src/site/pages/news.html | 5 ++++- 6 files changed, 40 insertions(+), 16 deletions(-) hooks/post-receive -- Logback: the generic, reliable, fast and flexible logging framework.
participants (1)
-
git-noreply@pixie.qos.ch