logback-dev
Threads by month
- ----- 2025 -----
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
March 2010
- 11 participants
- 188 discussions

[JIRA] Created: (LBCLASSIC-193) SyslogAppender quits after a while
by Ingo Siebert (JIRA) 17 Mar '10
by Ingo Siebert (JIRA) 17 Mar '10
17 Mar '10
SyslogAppender quits after a while
----------------------------------
Key: LBCLASSIC-193
URL: http://jira.qos.ch/browse/LBCLASSIC-193
Project: logback-classic
Issue Type: Bug
Components: appender
Affects Versions: 0.9.13, 0.9.14, 0.9.15, 0.9.16, 0.917, 0.9.18, 0.9.19
Environment: At least Debian Etch with JDK5
Reporter: Ingo Siebert
Assignee: Logback dev list
Priority: Critical
I have 5 applications servers and each one logs to one separate SysLog-Server. After Server-Restart, all is working fine.
But after several days and weeks, more and more servers doesn't log to he SysLog-Server anymore. But I can't see an Syslog-Error in my Logs.
I think this bug is related to http://jira.qos.ch/browse/LBCLASSIC-57.
In my opinion, the most important fix would be to re-creae the SysLog-Appender if an exception/error occurs or to avaid that the SysLog-Appender dies.
If I miss one single entry, than that's not nice. But if I miss all entries it's very serve.
The SysLog-Appender is useless for me until this bug is fixed.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
3
12

[GIT] Logback: the generic, reliable, fast and flexible logging framework. branch, master, updated. v0.9.18-83-g3faa7d8
by git-noreply@pixie.qos.ch 17 Mar '10
by git-noreply@pixie.qos.ch 17 Mar '10
17 Mar '10
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 3faa7d8bc517251201915d2add3e2f86cc25a649 (commit)
from df1f63a50268df0d6a9a9dcf352f4abc8766c74f (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=3faa7d8bc517251201915d2a…
http://github.com/ceki/logback/commit/3faa7d8bc517251201915d2add3e2f86cc25a…
commit 3faa7d8bc517251201915d2add3e2f86cc25a649
Author: Ceki Gulcu <ceki(a)qos.ch>
Date: Wed Mar 17 10:21:10 2010 +0100
Fixed http://jira.qos.ch/browse/LBCORE-143
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 5304874..265d787 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,6 +13,8 @@
*/
package ch.qos.logback.core;
+import ch.qos.logback.core.helpers.ConsoleOutputStreamWrapper;
+import ch.qos.logback.core.joran.spi.ConsoleTarget;
import ch.qos.logback.core.status.Status;
import ch.qos.logback.core.status.WarnStatus;
@@ -25,13 +27,14 @@ import ch.qos.logback.core.status.WarnStatus;
* at http://logback.qos.ch/manual/appenders.html#ConsoleAppender
*
* @author Ceki Gülcü
+ * @author Tom SH Liu
*/
public class ConsoleAppender<E> extends OutputStreamAppender<E> {
public static final String SYSTEM_OUT = "System.out";
public static final String SYSTEM_ERR = "System.err";
- protected String target = SYSTEM_OUT;
+ protected ConsoleTarget target = ConsoleTarget.SystemOut;
/**
* As in most logback components, the default constructor does nothing.
@@ -47,22 +50,28 @@ public class ConsoleAppender<E> extends OutputStreamAppender<E> {
String v = value.trim();
if (SYSTEM_OUT.equalsIgnoreCase(v)) {
- target = SYSTEM_OUT;
+ target = ConsoleTarget.SystemOut;
} else if (SYSTEM_ERR.equalsIgnoreCase(v)) {
- target = SYSTEM_ERR;
+ target = ConsoleTarget.SystemErr;
} else {
targetWarn(value);
}
}
/**
- * Returns the current value of the <b>Target</b> property. The default value
+ * Returns the current value of the <b>target</b> property. The default value
* of the option is "System.out".
*
* See also {@link #setTarget}.
*/
public String getTarget() {
- return target;
+ switch (target) {
+ case SystemOut:
+ return SYSTEM_OUT;
+ case SystemErr:
+ return SYSTEM_ERR;
+ }
+ throw new IllegalStateException("Unexpected target value ["+target+"]");
}
void targetWarn(String val) {
@@ -74,22 +83,8 @@ public class ConsoleAppender<E> extends OutputStreamAppender<E> {
}
public void start() {
- if (target.equals(SYSTEM_OUT)) {
- setOutputStream(System.out);
- } else {
- setOutputStream(System.err);
- }
+ setOutputStream(new ConsoleOutputStreamWrapper(target));
super.start();
}
- /**
- * This method overrides the parent
- * {@link OutputStreamAppender#closeOutputStream} implementation because the
- * console stream is not ours to close.
- */
- @Override
- protected final void closeOutputStream() {
- encoderClose();
- }
-
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/helpers/ConsoleOutputStreamWrapper.java b/logback-core/src/main/java/ch/qos/logback/core/helpers/ConsoleOutputStreamWrapper.java
new file mode 100644
index 0000000..ae53e03
--- /dev/null
+++ b/logback-core/src/main/java/ch/qos/logback/core/helpers/ConsoleOutputStreamWrapper.java
@@ -0,0 +1,71 @@
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2010, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under either
+ * the terms of the Eclipse Public License v1.0 as published by the Eclipse
+ * Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1 as
+ * published by the Free Software Foundation.
+ */
+package ch.qos.logback.core.helpers;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import ch.qos.logback.core.joran.spi.ConsoleTarget;
+
+/**
+ * An {@link OutputStream} which always outputs to the current value of
+ * System.out/System.err.
+ *
+ * @author Ceki Gülcü
+ * @author Tom SH Liu
+ */
+public class ConsoleOutputStreamWrapper extends OutputStream {
+
+ ConsoleTarget consoleTarget;
+
+ public ConsoleOutputStreamWrapper(ConsoleTarget consoleTarget) {
+ this.consoleTarget = consoleTarget;
+ }
+
+ private OutputStream getOutputStream() {
+ switch (consoleTarget) {
+ case SystemOut:
+ return System.out;
+ case SystemErr:
+ return System.err;
+ }
+ throw new IllegalStateException("Unpexpected consoleTarget value ["
+ + consoleTarget + "]");
+ }
+
+ @Override
+ public void write(int b) throws IOException {
+ getOutputStream().write(b);
+ }
+
+ @Override
+ public void write(byte b[]) throws IOException {
+ this.write(b, 0, b.length);
+ }
+
+ @Override
+ public void write(byte b[], int off, int len) throws IOException {
+ getOutputStream().write(b, off, len);
+ }
+
+ @Override
+ public void flush() throws IOException {
+ getOutputStream().flush();
+ }
+
+ @Override
+ public void close() throws IOException {
+ // the console is not ours to close
+ }
+}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/joran/spi/ConsoleTarget.java b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/ConsoleTarget.java
new file mode 100644
index 0000000..dfbcffb
--- /dev/null
+++ b/logback-core/src/main/java/ch/qos/logback/core/joran/spi/ConsoleTarget.java
@@ -0,0 +1,23 @@
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2010, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under either
+ * the terms of the Eclipse Public License v1.0 as published by the Eclipse
+ * Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1 as
+ * published by the Free Software Foundation.
+ */
+package ch.qos.logback.core.joran.spi;
+
+/**
+ * The set of console output targets.
+ *
+ * @author Ceki Gülcü
+ */
+public enum ConsoleTarget {
+ SystemOut, SystemErr;
+}
\ No newline at end of file
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 bce6931..e8e015c 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
@@ -27,6 +27,7 @@ import ch.qos.logback.core.Appender;
import ch.qos.logback.core.ConsoleAppender;
import ch.qos.logback.core.CoreConstants;
import ch.qos.logback.core.encoder.DummyEncoder;
+import ch.qos.logback.core.encoder.EchoEncoder;
import ch.qos.logback.core.encoder.NopEncoder;
import ch.qos.logback.core.layout.DummyLayout;
@@ -105,6 +106,21 @@ public class ConsoleAppenderTest extends AbstractAppenderTest<Object> {
assertEquals(DummyLayout.DUMMY + "CLOSED", tee.toString());
}
+ // See http://jira.qos.ch/browse/LBCORE-143
+ @Test
+ public void changeInConsole() {
+ ConsoleAppender<Object> ca = (ConsoleAppender<Object>) getAppender();
+ EchoEncoder<Object> encoder = new EchoEncoder<Object>();
+ ca.setEncoder(encoder);
+ ca.start();
+ ca.doAppend("a");
+ assertEquals("a"+CoreConstants.LINE_SEPARATOR, tee.toString());
+
+ XTeeOutputStream newTee = new XTeeOutputStream(null);
+ System.setOut(new PrintStream(newTee));
+ ca.doAppend("b");
+ assertEquals("b"+CoreConstants.LINE_SEPARATOR, newTee.toString());
+ }
@Test
diff --git a/logback-site/src/site/pages/news.html b/logback-site/src/site/pages/news.html
index 7a7be5a..1deacc2 100644
--- a/logback-site/src/site/pages/news.html
+++ b/logback-site/src/site/pages/news.html
@@ -109,8 +109,18 @@
href="http://jira.qos.ch/browse/LBCLASSIC-194">LBCLASSIC-194</a>.
</p>
+ <p>Instead of sending its output to the System.out/err reference
+ that was effective at initialization, <code>ConsoleAppender</code>
+ will now seek the most current System.out/err reference and send
+ its output there. This fixes <a
+ href="http://jira.qos.ch/browse/LBCORE-143">LBCORE-143</a> as
+ reported by Tom SH Liu.
+ </p>
+
<hr width="80%" align="center" />
+ <!-- ======================================================================== -->
+
<h3>3rd of December 2009 - Release of version 0.9.18</h3>
<p>After a very long investigation resulting in somewhat a better
-----------------------------------------------------------------------
Summary of changes:
.../java/ch/qos/logback/core/ConsoleAppender.java | 35 ++++------
.../core/helpers/ConsoleOutputStreamWrapper.java | 71 ++++++++++++++++++++
.../qos/logback/core/joran/spi/ConsoleTarget.java | 23 ++++++
.../logback/core/appender/ConsoleAppenderTest.java | 16 +++++
logback-site/src/site/pages/news.html | 10 +++
5 files changed, 135 insertions(+), 20 deletions(-)
create mode 100644 logback-core/src/main/java/ch/qos/logback/core/helpers/ConsoleOutputStreamWrapper.java
create mode 100644 logback-core/src/main/java/ch/qos/logback/core/joran/spi/ConsoleTarget.java
hooks/post-receive
--
Logback: the generic, reliable, fast and flexible logging framework.
1
0

[GIT] Logback: the generic, reliable, fast and flexible logging framework. branch, master, updated. v0.9.18-82-gdf1f63a
by git-noreply@pixie.qos.ch 17 Mar '10
by git-noreply@pixie.qos.ch 17 Mar '10
17 Mar '10
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 df1f63a50268df0d6a9a9dcf352f4abc8766c74f (commit)
from fd195dcaa9d37ecc26fe243c950f126c832cfe9a (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=df1f63a50268df0d6a9a9dcf…
http://github.com/ceki/logback/commit/df1f63a50268df0d6a9a9dcf352f4abc8766c…
commit df1f63a50268df0d6a9a9dcf352f4abc8766c74f
Author: Ceki Gulcu <ceki(a)qos.ch>
Date: Wed Mar 17 09:15:44 2010 +0100
- change in indentation in ConsoleAppender
- added paragraph about exemptions in license.html
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 ccc7cbb..5304874 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
@@ -16,81 +16,80 @@ package ch.qos.logback.core;
import ch.qos.logback.core.status.Status;
import ch.qos.logback.core.status.WarnStatus;
-
/**
* ConsoleAppender appends log events to <code>System.out</code> or
* <code>System.err</code> using a layout specified by the user. The default
* target is <code>System.out</code>.
- *
- * For more information about this appender, please refer to the online manual at
- * http://logback.qos.ch/manual/appenders.html#ConsoleAppender
- *
+ *
+ * For more information about this appender, please refer to the online manual
+ * at http://logback.qos.ch/manual/appenders.html#ConsoleAppender
+ *
* @author Ceki Gülcü
*/
public class ConsoleAppender<E> extends OutputStreamAppender<E> {
- public static final String SYSTEM_OUT = "System.out";
- public static final String SYSTEM_ERR = "System.err";
- protected String target = SYSTEM_OUT;
+ public static final String SYSTEM_OUT = "System.out";
+ public static final String SYSTEM_ERR = "System.err";
+ protected String target = SYSTEM_OUT;
- /**
- * As in most logback components, the default constructor does nothing.
- */
- public ConsoleAppender() {
- }
-
- /**
- * Sets the value of the <b>Target</b> option. Recognized values are
- * "System.out" and "System.err". Any other value will be ignored.
- */
- public void setTarget(String value) {
- String v = value.trim();
+ /**
+ * As in most logback components, the default constructor does nothing.
+ */
+ public ConsoleAppender() {
+ }
- if (SYSTEM_OUT.equalsIgnoreCase(v)) {
- target = SYSTEM_OUT;
- } else if (SYSTEM_ERR.equalsIgnoreCase(v)) {
- target = SYSTEM_ERR;
- } else {
- targetWarn(value);
- }
- }
+ /**
+ * Sets the value of the <b>Target</b> option. Recognized values are
+ * "System.out" and "System.err". Any other value will be ignored.
+ */
+ public void setTarget(String value) {
+ String v = value.trim();
- /**
- * Returns the current value of the <b>Target</b> property. The default
- * value of the option is "System.out".
- *
- * See also {@link #setTarget}.
- */
- public String getTarget() {
- return target;
+ if (SYSTEM_OUT.equalsIgnoreCase(v)) {
+ target = SYSTEM_OUT;
+ } else if (SYSTEM_ERR.equalsIgnoreCase(v)) {
+ target = SYSTEM_ERR;
+ } else {
+ targetWarn(value);
}
+ }
- void targetWarn(String val) {
- Status status = new WarnStatus("["+val+" should be System.out or System.err.", this);
- status.add(new WarnStatus("Using previously set target, System.out by default.", this));
- addStatus(status);
- }
+ /**
+ * Returns the current value of the <b>Target</b> property. The default value
+ * of the option is "System.out".
+ *
+ * See also {@link #setTarget}.
+ */
+ public String getTarget() {
+ return target;
+ }
- public void start() {
- if (target.equals(SYSTEM_OUT)) {
- setOutputStream(System.out);
- } else {
- setOutputStream(System.err);
- }
- super.start();
- }
+ void targetWarn(String val) {
+ Status status = new WarnStatus("[" + val
+ + " should be System.out or System.err.", this);
+ status.add(new WarnStatus(
+ "Using previously set target, System.out by default.", this));
+ addStatus(status);
+ }
- /**
- * This method overrides the parent {@link OutputStreamAppender#closeOutputStream}
- * implementation because the console stream is not ours to close.
- */
- @Override
- protected final void closeOutputStream() {
- encoderClose();
+ public void start() {
+ if (target.equals(SYSTEM_OUT)) {
+ setOutputStream(System.out);
+ } else {
+ setOutputStream(System.err);
}
-
-
+ super.start();
}
+ /**
+ * This method overrides the parent
+ * {@link OutputStreamAppender#closeOutputStream} implementation because the
+ * console stream is not ours to close.
+ */
+ @Override
+ protected final void closeOutputStream() {
+ encoderClose();
+ }
+}
diff --git a/logback-site/src/site/pages/license.html b/logback-site/src/site/pages/license.html
index 74fcdbc..2dbcc92 100644
--- a/logback-site/src/site/pages/license.html
+++ b/logback-site/src/site/pages/license.html
@@ -69,6 +69,11 @@ as published by the Free Software Foundation.</p>
formalize the terms of your contribution and to protect the
project in case of litigation.
</p>
+
+ <p>Upon request, we may exempt open-source projects from LGPL and
+ EPL's reciprocity clauses so that the said pojects can develop
+ logback extensions under the license of their choice. Exemptions
+ are granted on a case by case basis.</p>
<script src="templates/footer.js" type="text/javascript"></script>
</div>
-----------------------------------------------------------------------
Summary of changes:
.../java/ch/qos/logback/core/ConsoleAppender.java | 115 ++++++++++----------
logback-site/src/site/pages/license.html | 5 +
2 files changed, 62 insertions(+), 58 deletions(-)
hooks/post-receive
--
Logback: the generic, reliable, fast and flexible logging framework.
1
0

[JIRA] Created: (LBCLASSIC-194) At SMTPAppender, Prameter 'CharasetEncoding' cannot be set excluding UTF-8.
by Masanao Okada (JIRA) 16 Mar '10
by Masanao Okada (JIRA) 16 Mar '10
16 Mar '10
At SMTPAppender, Prameter 'CharasetEncoding' cannot be set excluding UTF-8.
---------------------------------------------------------------------------
Key: LBCLASSIC-194
URL: http://jira.qos.ch/browse/LBCLASSIC-194
Project: logback-classic
Issue Type: Bug
Components: appender
Affects Versions: 0.9.18
Reporter: Masanao Okada
Assignee: Logback dev list
Hello,
I use logback-0.9.18 and slf4j-1.5.11
At SMTPAppender, I want to encode in the designated charset using parameter 'CharsetEncoding'.
I set to look at the manual as follows.
(manual:http://logback.qos.ch/manual/appenders.html#SMTPAppender)
<configuration>
<appender name="EMAIL" class="ch.qos.logback.classic.net.SMTPAppender">
<SMTPHost>smtp.gmail.com</SMTPHost>
<SMTPPort>465</SMTPPort>
<SSL>true</SSL>
<Username>YOUR_USERNAME(a)gmail.com</Username>
<Password>YOUR_GMAIL_PASSWORD</Password>
<To>EMAIL-DESTINATION</To>
<From>YOUR_USERNAME(a)gmail.com</From>
<BufferSize>4</BufferSize>
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>%date %-5level %logger{255} - %message%n</Pattern>
</layout>
<CharsetEncoding>ISO-2022-JP</CharsetEncoding>
</appender>
<root>
<level value="ERROR" />
<appender-ref ref="EMAIL" />
</root>
</configuration>
I look at outgoing mail as follows.
Charset is not "ISO-2022-JP" !!
------=_Part_0_26281671.1268558498468
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
2010-03-14 18:21:38,250 ERROR logger.test.EncodingTest - Error Log
------=_Part_0_26281671.1268558498468--
'Encoding' 'CharsetEncoding' instead of using as follows, the result is the same.
<appender name="EMAIL" class="ch.qos.logback.classic.net.SMTPAppender">
....
<Encoding>ISO-2022-JP</Encoding>
....
</appender>
Could you confirm it?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
2
1

[GIT] Logback: the generic, reliable, fast and flexible logging framework. branch, master, updated. v0.9.18-81-gfd195dc
by git-noreply@pixie.qos.ch 16 Mar '10
by git-noreply@pixie.qos.ch 16 Mar '10
16 Mar '10
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 fd195dcaa9d37ecc26fe243c950f126c832cfe9a (commit)
from 36d3641c8af6d0174aec0bb4ce2d2ff446a85342 (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=fd195dcaa9d37ecc26fe243c…
http://github.com/ceki/logback/commit/fd195dcaa9d37ecc26fe243c950f126c832cf…
commit fd195dcaa9d37ecc26fe243c950f126c832cfe9a
Author: Ceki Gulcu <ceki(a)qos.ch>
Date: Tue Mar 16 22:55:14 2010 +0100
Fixed LBCLASSIC-194
diff --git a/logback-core/src/main/java/ch/qos/logback/core/net/SMTPAppenderBase.java b/logback-core/src/main/java/ch/qos/logback/core/net/SMTPAppenderBase.java
index b2be4b5..4b99245 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/net/SMTPAppenderBase.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/net/SMTPAppenderBase.java
@@ -423,7 +423,7 @@ public abstract class SMTPAppenderBase<E> extends AppenderBase<E> {
* @see #setCharsetEncoding(String)
* @return the charset encoding value
*/
- String getCharsetEncoding() {
+ public String getCharsetEncoding() {
return charsetEncoding;
}
@@ -433,7 +433,7 @@ public abstract class SMTPAppenderBase<E> extends AppenderBase<E> {
*
* @param charsetEncoding
*/
- void setCharsetEncoding(String charsetEncoding) {
+ public void setCharsetEncoding(String charsetEncoding) {
this.charsetEncoding = charsetEncoding;
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/net/SocketAppenderBase.java b/logback-core/src/main/java/ch/qos/logback/core/net/SocketAppenderBase.java
index 6850ca4..475451a 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/net/SocketAppenderBase.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/net/SocketAppenderBase.java
@@ -158,7 +158,6 @@ public abstract class SocketAppenderBase<E> extends AppenderBase<E> {
postProcessEvent(event);
Serializable serEvent = getPST().transform(event);
oos.writeObject(serEvent);
- // addInfo("=========Flushing.");
oos.flush();
if (++counter >= CoreConstants.OOS_RESET_FREQUENCY) {
counter = 0;
diff --git a/logback-examples/src/main/java/chapters/appenders/mail/EMail.java b/logback-examples/src/main/java/chapters/appenders/mail/EMail.java
index 7c9ce34..a991f7f 100644
--- a/logback-examples/src/main/java/chapters/appenders/mail/EMail.java
+++ b/logback-examples/src/main/java/chapters/appenders/mail/EMail.java
@@ -20,8 +20,6 @@ import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.joran.JoranConfigurator;
import ch.qos.logback.core.util.StatusPrinter;
-
-
/**
* This application generates log messages in numbers specified by the
* user.
@@ -35,6 +33,7 @@ public class EMail {
int runLength = Integer.parseInt(args[0]);
String configFile = args[1];
+
LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
JoranConfigurator configurator = new JoranConfigurator();
lc.reset();
diff --git a/logback-site/src/site/pages/manual/appenders.html b/logback-site/src/site/pages/manual/appenders.html
index 1b1c8ef..b6ab67e 100644
--- a/logback-site/src/site/pages/manual/appenders.html
+++ b/logback-site/src/site/pages/manual/appenders.html
@@ -2326,7 +2326,7 @@ Context ctx = new InitialContext(env);</pre>
configuration file, execute the following command:
</p>
-<div class="source"><pre>java chapters.appenders.mail.EMail 300 src/main/java/chapters/appenders/mail/mail.xml</pre></div>
+<div class="source"><pre>java chapters.appenders.mail.EMail 300 src/main/java/chapters/appenders/mail/mail1.xml</pre></div>
<p>The recipient you specified should receive an email message
containing 300 logging events formatted by
diff --git a/logback-site/src/site/pages/news.html b/logback-site/src/site/pages/news.html
index fa1ef89..7a7be5a 100644
--- a/logback-site/src/site/pages/news.html
+++ b/logback-site/src/site/pages/news.html
@@ -68,6 +68,12 @@
after the connection to the server is re-established.
</p>
+ <p>Fixed <a
+ href="http://jira.qos.ch/browse/LBCLASSIC-193">LBCLASSIC-193</a>. <code>SyslogAppender</code>
+ will no longer shutdown when messages over 256Kb cause an
+ <code>IOException</code>.
+ </p>
+
<p>Added <a
href="manual/appenders.html#OnMarkerEvaluator">OnMarkerEvaluator</a>
which evaluates to true in the presence of user-specified
@@ -97,6 +103,12 @@
no longer treats parenthesis as special.
</p>
+ <p>The <span class="option">CharsetEncoder</span> property in
+ <code>SMTPAppender</code> can now be accessed and set from
+ configuration files. This fixes <a
+ href="http://jira.qos.ch/browse/LBCLASSIC-194">LBCLASSIC-194</a>.
+ </p>
+
<hr width="80%" align="center" />
<h3>3rd of December 2009 - Release of version 0.9.18</h3>
-----------------------------------------------------------------------
Summary of changes:
.../ch/qos/logback/core/net/SMTPAppenderBase.java | 4 ++--
.../qos/logback/core/net/SocketAppenderBase.java | 1 -
.../main/java/chapters/appenders/mail/EMail.java | 3 +--
logback-site/src/site/pages/manual/appenders.html | 2 +-
logback-site/src/site/pages/news.html | 12 ++++++++++++
5 files changed, 16 insertions(+), 6 deletions(-)
hooks/post-receive
--
Logback: the generic, reliable, fast and flexible logging framework.
1
0

[GIT] Logback: the generic, reliable, fast and flexible logging framework. branch, master, updated. v0.9.18-80-g36d3641
by git-noreply@pixie.qos.ch 16 Mar '10
by git-noreply@pixie.qos.ch 16 Mar '10
16 Mar '10
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 36d3641c8af6d0174aec0bb4ce2d2ff446a85342 (commit)
from 49e948fd49e0c62c325320b700c28db219be8314 (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=36d3641c8af6d0174aec0bb4…
http://github.com/ceki/logback/commit/36d3641c8af6d0174aec0bb4ce2d2ff446a85…
commit 36d3641c8af6d0174aec0bb4ce2d2ff446a85342
Author: Ceki Gulcu <ceki(a)qos.ch>
Date: Tue Mar 16 18:54:26 2010 +0100
- fixing LBCLASSIC-193
diff --git a/logback-classic/src/main/java/ch/qos/logback/classic/net/SyslogAppender.java b/logback-classic/src/main/java/ch/qos/logback/classic/net/SyslogAppender.java
index 7c066da..67845db 100644
--- a/logback-classic/src/main/java/ch/qos/logback/classic/net/SyslogAppender.java
+++ b/logback-classic/src/main/java/ch/qos/logback/classic/net/SyslogAppender.java
@@ -14,6 +14,7 @@
package ch.qos.logback.classic.net;
import java.io.IOException;
+import java.io.OutputStream;
import ch.qos.logback.classic.PatternLayout;
import ch.qos.logback.classic.pattern.SyslogStartConverter;
@@ -24,7 +25,6 @@ import ch.qos.logback.classic.util.LevelToSyslogSeverity;
import ch.qos.logback.core.CoreConstants;
import ch.qos.logback.core.Layout;
import ch.qos.logback.core.net.SyslogAppenderBase;
-import ch.qos.logback.core.net.SyslogWriter;
/**
* This appender can be used to send messages to a remote syslog daemon. <p> For
@@ -75,7 +75,7 @@ public class SyslogAppender extends SyslogAppenderBase<ILoggingEvent> {
}
@Override
- protected void postProcess(Object eventObject, SyslogWriter sw) {
+ protected void postProcess(Object eventObject, OutputStream sw) {
ILoggingEvent event = (ILoggingEvent) eventObject;
String prefix = prefixLayout.doLayout(event);
@@ -85,9 +85,9 @@ public class SyslogAppender extends SyslogAppenderBase<ILoggingEvent> {
StackTraceElementProxy[] stepArray = tp.getStackTraceElementProxyArray();
try {
for (StackTraceElementProxy step : stepArray) {
- sw.write(prefix);
- sw.write(CoreConstants.TAB);
- sw.write(step.toString());
+ StringBuilder sb = new StringBuilder();
+ sb.append(prefix).append(CoreConstants.TAB).append(step);
+ sw.write(sb.toString().getBytes());
sw.flush();
}
} catch (IOException e) {
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/SyslogAppenderTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/SyslogAppenderTest.java
index d2a0567..83056a6 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/SyslogAppenderTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/SyslogAppenderTest.java
@@ -21,38 +21,45 @@ import org.junit.Before;
import org.junit.Test;
import org.slf4j.LoggerFactory;
+import ch.qos.logback.classic.ClassicTestConstants;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.LoggerContext;
-import ch.qos.logback.classic.ClassicTestConstants;
import ch.qos.logback.classic.joran.JoranConfigurator;
import ch.qos.logback.classic.net.mock.MockSyslogServer;
import ch.qos.logback.core.joran.spi.JoranException;
import ch.qos.logback.core.net.SyslogConstants;
+import ch.qos.logback.core.recovery.RecoveryCoordinator;
import ch.qos.logback.core.testUtil.RandomUtil;
+import ch.qos.logback.core.util.StatusPrinter;
public class SyslogAppenderTest {
+ LoggerContext lc = new LoggerContext();
+ SyslogAppender sa = new SyslogAppender();
+ MockSyslogServer mockServer;
+ String loggerName = this.getClass().getName();
+ Logger logger = lc.getLogger(loggerName);
+
@Before
public void setUp() throws Exception {
+ lc.setName("test");
+ sa.setContext(lc);
}
@After
public void tearDown() throws Exception {
}
- @Test
- public void basic() throws InterruptedException {
+ public void setMockServerAndConfigure(int expectedCount)
+ throws InterruptedException {
int port = RandomUtil.getRandomServerPort();
- MockSyslogServer mockServer = new MockSyslogServer(1, port);
+ mockServer = new MockSyslogServer(expectedCount, port);
mockServer.start();
// give MockSyslogServer head start
+
Thread.sleep(100);
- LoggerContext lc = new LoggerContext();
- lc.setName("test");
- SyslogAppender sa = new SyslogAppender();
- sa.setContext(lc);
sa.setSyslogHost("localhost");
sa.setFacility("MAIL");
sa.setPort(port);
@@ -63,12 +70,20 @@ public class SyslogAppenderTest {
String loggerName = this.getClass().getName();
Logger logger = lc.getLogger(loggerName);
logger.addAppender(sa);
+
+ }
+
+ @Test
+ public void basic() throws InterruptedException {
+
+ setMockServerAndConfigure(1);
String logMsg = "hello";
logger.debug(logMsg);
// wait max 2 seconds for mock server to finish. However, it should
// much sooner than that.
mockServer.join(8000);
+
assertTrue(mockServer.isFinished());
assertEquals(1, mockServer.getMessageList().size());
String msg = mockServer.getMessageList().get(0);
@@ -80,39 +95,20 @@ public class SyslogAppenderTest {
assertTrue(msg.startsWith(expected));
String first = "<\\d{2}>\\w{3} \\d{2} \\d{2}(:\\d{2}){2} [\\w.-]* ";
- checkRegexMatch(msg, first + "\\[" + threadName + "\\] " + loggerName
- + " " + logMsg);
+ checkRegexMatch(msg, first + "\\[" + threadName + "\\] " + loggerName + " "
+ + logMsg);
}
@Test
public void tException() throws InterruptedException {
- int port = RandomUtil.getRandomServerPort();
-
- MockSyslogServer mockServer = new MockSyslogServer(21, port);
- mockServer.start();
- // give MockSyslogServer head start
- Thread.sleep(100);
-
- LoggerContext lc = new LoggerContext();
- lc.setName("test");
- SyslogAppender sa = new SyslogAppender();
- sa.setContext(lc);
- sa.setSyslogHost("localhost");
- sa.setFacility("MAIL");
- sa.setPort(port);
- sa.setSuffixPattern("[%thread] %logger %msg");
- sa.start();
- assertTrue(sa.isStarted());
+ setMockServerAndConfigure(21);
- String loggerName = this.getClass().getName();
- Logger logger = lc.getLogger(loggerName);
- logger.addAppender(sa);
String logMsg = "hello";
String exMsg = "just testing";
Exception ex = new Exception(exMsg);
logger.debug(logMsg, ex);
- // StatusPrinter.print(lc.getStatusManager());
+ StatusPrinter.print(lc);
// wait max 2 seconds for mock server to finish. However, it should
// much sooner than that.
@@ -133,13 +129,44 @@ public class SyslogAppenderTest {
String expectedPrefix = "<\\d{2}>\\w{3} \\d{2} \\d{2}(:\\d{2}){2} [\\w.-]* ";
String threadName = Thread.currentThread().getName();
- String regex = expectedPrefix + "\\[" + threadName + "\\] "
- + loggerName + " " + logMsg;
+ String regex = expectedPrefix + "\\[" + threadName + "\\] " + loggerName
+ + " " + logMsg;
checkRegexMatch(msg, regex);
}
-
+
private void checkRegexMatch(String s, String regex) {
- assertTrue("The string ["+s+"] did not match regex ["+regex+"]", s.matches(regex));
+ assertTrue("The string [" + s + "] did not match regex [" + regex + "]", s
+ .matches(regex));
+ }
+
+ @Test
+ public void large() throws InterruptedException {
+ setMockServerAndConfigure(1);
+ StringBuilder largeBuf = new StringBuilder();
+ for (int i = 0; i < 2 * 1024 * 1024; i++) {
+ largeBuf.append('a');
+ }
+ logger.debug(largeBuf.toString());
+
+ String logMsg = "hello";
+ logger.debug(logMsg);
+ Thread.sleep(RecoveryCoordinator.BACKOFF_COEFFICIENT_MIN+10);
+ logger.debug(logMsg);
+
+ mockServer.join(8000);
+ assertTrue(mockServer.isFinished());
+
+ // the first message is wasted
+ assertEquals(1, mockServer.getMessageList().size());
+ String msg = mockServer.getMessageList().get(0);
+ String expected = "<"
+ + (SyslogConstants.LOG_MAIL + SyslogConstants.DEBUG_SEVERITY) + ">";
+ assertTrue(msg.startsWith(expected));
+ String expectedPrefix = "<\\d{2}>\\w{3} \\d{2} \\d{2}(:\\d{2}){2} [\\w.-]* ";
+ String threadName = Thread.currentThread().getName();
+ String regex = expectedPrefix + "\\[" + threadName + "\\] " + loggerName
+ + " " + logMsg;
+ checkRegexMatch(msg, regex);
}
@Test
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockSyslogServer.java b/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockSyslogServer.java
index 9bea188..b85344b 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockSyslogServer.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/net/mock/MockSyslogServer.java
@@ -48,7 +48,6 @@ public class MockSyslogServer extends Thread {
DatagramPacket packet = new DatagramPacket(buf, buf.length);
//System.out.println("Waiting for message");
socket.receive(packet);
- //System.out.println("Got message");
String msg = new String(buf, 0, packet.getLength());
msgList.add(msg);
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/net/SyslogAppenderBase.java b/logback-core/src/main/java/ch/qos/logback/core/net/SyslogAppenderBase.java
index 551de9e..d0cf074 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/net/SyslogAppenderBase.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/net/SyslogAppenderBase.java
@@ -14,6 +14,7 @@
package ch.qos.logback.core.net;
import java.io.IOException;
+import java.io.OutputStream;
import java.net.SocketException;
import java.net.UnknownHostException;
@@ -25,19 +26,20 @@ import ch.qos.logback.core.Layout;
* Base class for SyslogAppender.
*
* @author Ceki Gülcü
- *
+ *
* @param <E>
*/
public abstract class SyslogAppenderBase<E> extends AppenderBase<E> {
- final static String SYSLOG_LAYOUT_URL = CoreConstants.CODES_URL + "#syslog_layout";
- final static int MSG_SIZE_LIMIT = 256*1024;
-
+ final static String SYSLOG_LAYOUT_URL = CoreConstants.CODES_URL
+ + "#syslog_layout";
+ final static int MSG_SIZE_LIMIT = 256 * 1024;
+
Layout<E> layout;
String facilityStr;
String syslogHost;
protected String suffixPattern;
- SyslogWriter sw;
+ SyslogOutputStream sos;
int port = SyslogConstants.SYSLOG_PORT;
public void start() {
@@ -48,13 +50,14 @@ public abstract class SyslogAppenderBase<E> extends AppenderBase<E> {
}
try {
- sw = new SyslogWriter(syslogHost, port);
+ sos = new SyslogOutputStream(syslogHost, port);
} catch (UnknownHostException e) {
addError("Could not create SyslogWriter", e);
errorCount++;
} catch (SocketException e) {
- errorCount++;
- addError("Failed to bind to a random datagram socket ", e);
+ addWarn(
+ "Failed to bind to a random datagram socket. Will try to reconnect later.",
+ e);
}
if (layout == null) {
@@ -65,7 +68,7 @@ public abstract class SyslogAppenderBase<E> extends AppenderBase<E> {
super.start();
}
}
-
+
abstract public Layout<E> buildLayout(String facilityStr);
abstract public int getSeverityForEvent(Object eventObject);
@@ -78,20 +81,19 @@ public abstract class SyslogAppenderBase<E> extends AppenderBase<E> {
try {
String msg = layout.doLayout(eventObject);
- if(msg != null && msg.length() > MSG_SIZE_LIMIT) {
+ if (msg != null && msg.length() > MSG_SIZE_LIMIT) {
msg = msg.substring(0, MSG_SIZE_LIMIT);
}
- sw.write(msg);
- sw.flush();
- postProcess(eventObject, sw);
+ sos.write(msg.getBytes());
+ sos.flush();
+ postProcess(eventObject, sos);
} catch (IOException ioe) {
addError("Failed to send diagram to " + syslogHost, ioe);
- stop();
}
}
-
- protected void postProcess(Object event, SyslogWriter sw) {
-
+
+ protected void postProcess(Object event, OutputStream sw) {
+
}
/**
@@ -174,10 +176,10 @@ public abstract class SyslogAppenderBase<E> extends AppenderBase<E> {
}
/**
- * The <b>Facility</b> option must be set one of the strings KERN, USER,
- * MAIL, DAEMON, AUTH, SYSLOG, LPR, NEWS, UUCP, CRON, AUTHPRIV, FTP, NTP,
- * AUDIT, ALERT, CLOCK, LOCAL0, LOCAL1, LOCAL2, LOCAL3, LOCAL4, LOCAL5,
- * LOCAL6, LOCAL7. Case is not important.
+ * The <b>Facility</b> option must be set one of the strings KERN, USER, MAIL,
+ * DAEMON, AUTH, SYSLOG, LPR, NEWS, UUCP, CRON, AUTHPRIV, FTP, NTP, AUDIT,
+ * ALERT, CLOCK, LOCAL0, LOCAL1, LOCAL2, LOCAL3, LOCAL4, LOCAL5, LOCAL6,
+ * LOCAL7. Case is not important.
*
* <p>
* See {@link SyslogConstants} and RFC 3164 for more information about the
@@ -206,22 +208,22 @@ public abstract class SyslogAppenderBase<E> extends AppenderBase<E> {
this.port = port;
}
-
public Layout<E> getLayout() {
return layout;
}
public void setLayout(Layout<E> layout) {
- addWarn("The layout of a SyslogAppender cannot be set directly. See also "+SYSLOG_LAYOUT_URL);
+ addWarn("The layout of a SyslogAppender cannot be set directly. See also "
+ + SYSLOG_LAYOUT_URL);
}
@Override
public void stop() {
- sw.close();
+ sos.close();
super.stop();
}
- /**
+/**
* See {@link #setSuffixPattern(String).
*
* @return
diff --git a/logback-core/src/main/java/ch/qos/logback/core/net/SyslogWriter.java b/logback-core/src/main/java/ch/qos/logback/core/net/SyslogOutputStream.java
similarity index 61%
rename from logback-core/src/main/java/ch/qos/logback/core/net/SyslogWriter.java
rename to logback-core/src/main/java/ch/qos/logback/core/net/SyslogOutputStream.java
index bedecd3..1e20aeb 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/net/SyslogWriter.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/net/SyslogOutputStream.java
@@ -13,8 +13,9 @@
*/
package ch.qos.logback.core.net;
+import java.io.ByteArrayOutputStream;
import java.io.IOException;
-import java.io.Writer;
+import java.io.OutputStream;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
@@ -22,10 +23,10 @@ import java.net.SocketException;
import java.net.UnknownHostException;
/**
- * SyslogWriter is a wrapper around the {@link DatagramSocket} class so that it
- * behaves like a {@link Writer}.
+ * SyslogOutputStream is a wrapper around the {@link DatagramSocket} class so that it
+ * behaves like an {@link OutputStream}.
*/
-public class SyslogWriter extends Writer {
+public class SyslogOutputStream extends OutputStream {
/**
* The maximum length after which we discard the existing string buffer and
@@ -35,39 +36,41 @@ public class SyslogWriter extends Writer {
private InetAddress address;
private DatagramSocket ds;
- private StringBuffer buf = new StringBuffer();
+ private ByteArrayOutputStream baos = new ByteArrayOutputStream();
final private int port;
- public SyslogWriter(String syslogHost, int port) throws UnknownHostException,
+ public SyslogOutputStream(String syslogHost, int port) throws UnknownHostException,
SocketException {
this.address = InetAddress.getByName(syslogHost);
this.port = port;
this.ds = new DatagramSocket();
}
- public void write(char[] charArray, int offset, int len) throws IOException {
- buf.append(charArray, offset, len);
- }
-
- public void write(String str) throws IOException {
- buf.append(str);
-
+ public void write(byte[] byteArray, int offset, int len) throws IOException {
+ baos.write(byteArray, offset, len);
}
public void flush() throws IOException {
- byte[] bytes = buf.toString().getBytes();
+ byte[] bytes = baos.toByteArray();
DatagramPacket packet = new DatagramPacket(bytes, bytes.length, address,
port);
- if (this.ds != null) {
- ds.send(packet);
- }
// clean up for next round
- if (buf.length() > MAX_LEN) {
- buf = new StringBuffer();
+ if (baos.size() > MAX_LEN) {
+ baos = new ByteArrayOutputStream();
} else {
- buf.setLength(0);
+ baos.reset();
}
+
+ // after a failure, it can happen that bytes.length is zero
+ // in that case, there is no point in sending out an empty message/
+ if(bytes.length == 0) {
+ return;
+ }
+ if (this.ds != null) {
+ ds.send(packet);
+ }
+
}
public void close() {
@@ -79,4 +82,9 @@ public class SyslogWriter extends Writer {
return port;
}
+ @Override
+ public void write(int b) throws IOException {
+ baos.write(b);
+ }
+
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/recovery/ResilientFileOutputStream.java b/logback-core/src/main/java/ch/qos/logback/core/recovery/ResilientFileOutputStream.java
index cbe3b90..27331e2 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/recovery/ResilientFileOutputStream.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/recovery/ResilientFileOutputStream.java
@@ -20,35 +20,22 @@ import java.io.IOException;
import java.io.OutputStream;
import java.nio.channels.FileChannel;
-import ch.qos.logback.core.Context;
-import ch.qos.logback.core.status.ErrorStatus;
-import ch.qos.logback.core.status.InfoStatus;
-import ch.qos.logback.core.status.Status;
-import ch.qos.logback.core.status.StatusManager;
+public class ResilientFileOutputStream extends ResilientOutputStreamBase {
-public class ResilientFileOutputStream extends OutputStream {
-
- final static int STATUS_COUNT_LIMIT = 2 * 4;
-
- private int noContextWarning = 0;
- private int statusCount = 0;
-
- Context context;
- RecoveryCoordinator recoveryCoordinator;
- FileOutputStream fos;
File file;
- boolean presumedClean = true;
public ResilientFileOutputStream(File file, boolean append)
throws FileNotFoundException {
this.file = file;
- fos = new FileOutputStream(file, append);
+ this.os = new FileOutputStream(file, append);
+ this.presumedClean = true;
}
public FileChannel getChannel() {
- if (fos == null) {
+ if (os == null) {
return null;
}
+ final FileOutputStream fos = (FileOutputStream) os;
return fos.getChannel();
}
@@ -56,124 +43,21 @@ public class ResilientFileOutputStream extends OutputStream {
return file;
}
- final private boolean isPresumedInError() {
- // existence of recoveryCoordinator indicates failed state
- return (recoveryCoordinator != null && !presumedClean);
- }
-
- public void write(byte b[], int off, int len) {
- if (isPresumedInError()) {
- if (!recoveryCoordinator.isTooSoon()) {
- attemptRecovery();
- }
- return; // return regardless of the success of the recovery attempt
- }
-
- try {
- fos.write(b, off, len);
- postSuccessfulWrite();
- } catch (IOException e) {
- postIOFailure(e);
- }
- }
@Override
- public void write(int b) {
- if (isPresumedInError()) {
- if (!recoveryCoordinator.isTooSoon()) {
- attemptRecovery();
- }
- return; // return regardless of the success of the recovery attempt
- }
- try {
- fos.write(b);
- postSuccessfulWrite();
- } catch (IOException e) {
- postIOFailure(e);
- }
- }
-
- final private void postSuccessfulWrite() {
- if (recoveryCoordinator != null) {
- recoveryCoordinator = null;
- statusCount = 0;
- addStatus(new InfoStatus("Recovered from IO failure on file [" + file
- + "]", this));
- }
- }
-
- void postIOFailure(IOException e) {
- addStatusIfCountNotOverLimit(new ErrorStatus(
- "IO failure while writing to [" + file + "]", this, e));
- presumedClean = false;
- if (recoveryCoordinator == null) {
- recoveryCoordinator = new RecoveryCoordinator();
- }
+ String getDescription() {
+ return "file ["+file+"]";
}
@Override
- public void close() throws IOException {
- if (fos != null) {
- fos.close();
- }
+ OutputStream openNewOutputStream() throws IOException {
+ return new FileOutputStream(file, true);
}
-
- void attemptRecovery() {
- try {
- close();
- } catch (IOException e) {
- }
-
- addStatusIfCountNotOverLimit(new InfoStatus(
- "Attempting to recover from IO failure on file [" + file + "]", this));
-
- // subsequent writes must always be in append mode
- try {
- fos = new FileOutputStream(file, true);
- presumedClean = true;
- } catch (IOException e) {
- addStatusIfCountNotOverLimit(new ErrorStatus("Failed to open file ["
- + file + "]", this, e));
- }
- }
-
- void addStatusIfCountNotOverLimit(Status s) {
- ++statusCount;
- if (statusCount < STATUS_COUNT_LIMIT) {
- addStatus(s);
- }
-
- if (statusCount == STATUS_COUNT_LIMIT) {
- addStatus(s);
- addStatus(new InfoStatus("Will supress future messages regarding ["
- + file + "]", this));
- }
- }
-
- public void addStatus(Status status) {
- if (context == null) {
- if (noContextWarning++ == 0) {
- System.out.println("LOGBACK: No context given for " + this);
- }
- return;
- }
- StatusManager sm = context.getStatusManager();
- if (sm != null) {
- sm.add(status);
- }
- }
-
- public Context getContext() {
- return context;
- }
-
- public void setContext(Context context) {
- this.context = context;
- }
-
+
@Override
public String toString() {
return "c.q.l.c.recovery.ResilientFileOutputStream@"
+ System.identityHashCode(this);
}
+
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/recovery/ResilientFileOutputStream.java b/logback-core/src/main/java/ch/qos/logback/core/recovery/ResilientOutputStreamBase.java
similarity index 70%
copy from logback-core/src/main/java/ch/qos/logback/core/recovery/ResilientFileOutputStream.java
copy to logback-core/src/main/java/ch/qos/logback/core/recovery/ResilientOutputStreamBase.java
index cbe3b90..8cb9b6d 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/recovery/ResilientFileOutputStream.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/recovery/ResilientOutputStreamBase.java
@@ -13,12 +13,8 @@
*/
package ch.qos.logback.core.recovery;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
-import java.nio.channels.FileChannel;
import ch.qos.logback.core.Context;
import ch.qos.logback.core.status.ErrorStatus;
@@ -26,35 +22,18 @@ import ch.qos.logback.core.status.InfoStatus;
import ch.qos.logback.core.status.Status;
import ch.qos.logback.core.status.StatusManager;
-public class ResilientFileOutputStream extends OutputStream {
+abstract public class ResilientOutputStreamBase extends OutputStream {
final static int STATUS_COUNT_LIMIT = 2 * 4;
private int noContextWarning = 0;
private int statusCount = 0;
- Context context;
- RecoveryCoordinator recoveryCoordinator;
- FileOutputStream fos;
- File file;
- boolean presumedClean = true;
+ private Context context;
+ private RecoveryCoordinator recoveryCoordinator;
- public ResilientFileOutputStream(File file, boolean append)
- throws FileNotFoundException {
- this.file = file;
- fos = new FileOutputStream(file, append);
- }
-
- public FileChannel getChannel() {
- if (fos == null) {
- return null;
- }
- return fos.getChannel();
- }
-
- public File getFile() {
- return file;
- }
+ protected OutputStream os;
+ protected boolean presumedClean = true;
final private boolean isPresumedInError() {
// existence of recoveryCoordinator indicates failed state
@@ -70,7 +49,7 @@ public class ResilientFileOutputStream extends OutputStream {
}
try {
- fos.write(b, off, len);
+ os.write(b, off, len);
postSuccessfulWrite();
} catch (IOException e) {
postIOFailure(e);
@@ -86,26 +65,42 @@ public class ResilientFileOutputStream extends OutputStream {
return; // return regardless of the success of the recovery attempt
}
try {
- fos.write(b);
+ os.write(b);
postSuccessfulWrite();
} catch (IOException e) {
postIOFailure(e);
}
}
+ @Override
+ public void flush() {
+ if (os != null) {
+ try {
+ os.flush();
+ postSuccessfulWrite();
+ } catch (IOException e) {
+ postIOFailure(e);
+ }
+ }
+ }
+
+ abstract String getDescription();
+
+ abstract OutputStream openNewOutputStream() throws IOException;
+
final private void postSuccessfulWrite() {
if (recoveryCoordinator != null) {
recoveryCoordinator = null;
statusCount = 0;
- addStatus(new InfoStatus("Recovered from IO failure on file [" + file
- + "]", this));
+ addStatus(new InfoStatus("Recovered from IO failure on "
+ + getDescription(), this));
}
}
void postIOFailure(IOException e) {
- addStatusIfCountNotOverLimit(new ErrorStatus(
- "IO failure while writing to [" + file + "]", this, e));
- presumedClean = false;
+ addStatusIfCountNotOverLimit(new ErrorStatus("IO failure while writing to "
+ + getDescription(), this, e));
+ presumedClean = false;
if (recoveryCoordinator == null) {
recoveryCoordinator = new RecoveryCoordinator();
}
@@ -113,8 +108,8 @@ public class ResilientFileOutputStream extends OutputStream {
@Override
public void close() throws IOException {
- if (fos != null) {
- fos.close();
+ if (os != null) {
+ os.close();
}
}
@@ -125,15 +120,15 @@ public class ResilientFileOutputStream extends OutputStream {
}
addStatusIfCountNotOverLimit(new InfoStatus(
- "Attempting to recover from IO failure on file [" + file + "]", this));
+ "Attempting to recover from IO failure on " + getDescription(), this));
// subsequent writes must always be in append mode
try {
- fos = new FileOutputStream(file, true);
+ os = openNewOutputStream();
presumedClean = true;
} catch (IOException e) {
- addStatusIfCountNotOverLimit(new ErrorStatus("Failed to open file ["
- + file + "]", this, e));
+ addStatusIfCountNotOverLimit(new ErrorStatus("Failed to open "
+ + getDescription(), this, e));
}
}
@@ -145,8 +140,8 @@ public class ResilientFileOutputStream extends OutputStream {
if (statusCount == STATUS_COUNT_LIMIT) {
addStatus(s);
- addStatus(new InfoStatus("Will supress future messages regarding ["
- + file + "]", this));
+ addStatus(new InfoStatus("Will supress future messages regarding "
+ + getDescription(), this));
}
}
@@ -170,10 +165,4 @@ public class ResilientFileOutputStream extends OutputStream {
public void setContext(Context context) {
this.context = context;
}
-
- @Override
- public String toString() {
- return "c.q.l.c.recovery.ResilientFileOutputStream@"
- + System.identityHashCode(this);
- }
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/recovery/ResilientSyslogOutputStream.java b/logback-core/src/main/java/ch/qos/logback/core/recovery/ResilientSyslogOutputStream.java
new file mode 100644
index 0000000..d3c3822
--- /dev/null
+++ b/logback-core/src/main/java/ch/qos/logback/core/recovery/ResilientSyslogOutputStream.java
@@ -0,0 +1,53 @@
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2010, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under either
+ * the terms of the Eclipse Public License v1.0 as published by the Eclipse
+ * Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1 as
+ * published by the Free Software Foundation.
+ */
+package ch.qos.logback.core.recovery;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.SocketException;
+import java.net.UnknownHostException;
+
+import ch.qos.logback.core.net.SyslogOutputStream;
+
+public class ResilientSyslogOutputStream extends ResilientOutputStreamBase {
+
+
+ String syslogHost;
+ int port;
+
+ public ResilientSyslogOutputStream(String syslogHost, int port)
+ throws UnknownHostException, SocketException {
+ this.syslogHost = syslogHost;
+ this.port = port;
+ super.os = new SyslogOutputStream(syslogHost, port);
+ this.presumedClean = true;
+ }
+
+ @Override
+ String getDescription() {
+ return "syslog ["+syslogHost+":"+port+"]";
+ }
+
+ @Override
+ OutputStream openNewOutputStream() throws IOException {
+ return new SyslogOutputStream(syslogHost, port);
+ }
+
+ @Override
+ public String toString() {
+ return "c.q.l.c.recovery.ResilientSyslogOutputStream@"
+ + System.identityHashCode(this);
+ }
+
+}
-----------------------------------------------------------------------
Summary of changes:
.../ch/qos/logback/classic/net/SyslogAppender.java | 10 +-
.../logback/classic/net/SyslogAppenderTest.java | 97 +++++++++-----
.../logback/classic/net/mock/MockSyslogServer.java | 1 -
.../qos/logback/core/net/SyslogAppenderBase.java | 52 ++++----
.../{SyslogWriter.java => SyslogOutputStream.java} | 48 ++++---
.../core/recovery/ResilientFileOutputStream.java | 138 ++------------------
...tStream.java => ResilientOutputStreamBase.java} | 83 +++++-------
.../core/recovery/ResilientSyslogOutputStream.java | 53 ++++++++
8 files changed, 222 insertions(+), 260 deletions(-)
rename logback-core/src/main/java/ch/qos/logback/core/net/{SyslogWriter.java => SyslogOutputStream.java} (61%)
copy logback-core/src/main/java/ch/qos/logback/core/recovery/{ResilientFileOutputStream.java => ResilientOutputStreamBase.java} (70%)
create mode 100644 logback-core/src/main/java/ch/qos/logback/core/recovery/ResilientSyslogOutputStream.java
hooks/post-receive
--
Logback: the generic, reliable, fast and flexible logging framework.
1
0

[GIT] Logback: the generic, reliable, fast and flexible logging framework. branch, master, updated. v0.9.18-79-g49e948f
by git-noreply@pixie.qos.ch 12 Mar '10
by git-noreply@pixie.qos.ch 12 Mar '10
12 Mar '10
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 49e948fd49e0c62c325320b700c28db219be8314 (commit)
from 7ffb4f83eb56a595d6757c58aae0812d2686ac4d (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=49e948fd49e0c62c325320b7…
http://github.com/ceki/logback/commit/49e948fd49e0c62c325320b700c28db219be8…
commit 49e948fd49e0c62c325320b700c28db219be8314
Author: Ceki Gulcu <ceki(a)qos.ch>
Date: Fri Mar 12 22:37:03 2010 +0100
- continued work on the docs
diff --git a/logback-core/src/main/java/ch/qos/logback/core/html/HTMLLayoutBase.java b/logback-core/src/main/java/ch/qos/logback/core/html/HTMLLayoutBase.java
index 43282dc..5ee84d0 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/html/HTMLLayoutBase.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/html/HTMLLayoutBase.java
@@ -169,11 +169,7 @@ public abstract class HTMLLayoutBase<E> extends LayoutBase<E> {
sbuf.append(LINE_SEPARATOR);
cssBuilder.addCss(sbuf);
-// if (cssBuilder == null) {
-// DefaultCssBuilder.addDefaultCSS(sbuf);
-// } else {
-// cssBuilder.addExternalCSS(sbuf);
-// }
+
sbuf.append(LINE_SEPARATOR);
sbuf.append(" </head>");
sbuf.append(LINE_SEPARATOR);
diff --git a/logback-examples/src/main/java/chapters/layouts/log4jXMLLayout.xml b/logback-examples/src/main/java/chapters/layouts/log4jXMLLayout.xml
new file mode 100644
index 0000000..034162e
--- /dev/null
+++ b/logback-examples/src/main/java/chapters/layouts/log4jXMLLayout.xml
@@ -0,0 +1,14 @@
+<configuration>
+ <appender name="FILE" class="ch.qos.logback.core.FileAppender">
+ <file>test.xml</file>
+ <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
+ <layout class="ch.qos.logback.classic.log4j.XMLLayout">
+ <locationInfo>true</locationInfo>
+ </layout>
+ </encoder>
+ </appender>
+
+ <root level="DEBUG">
+ <appender-ref ref="FILE" />
+ </root>
+</configuration>
\ No newline at end of file
diff --git a/logback-site/src/site/pages/faq.html b/logback-site/src/site/pages/faq.html
index d5ab5b9..12f8427 100644
--- a/logback-site/src/site/pages/faq.html
+++ b/logback-site/src/site/pages/faq.html
@@ -26,9 +26,8 @@
<h3>Logback project</h3>
<ol>
- <li><a href="#why_lgpl">Why is logback distributed under LGPL and
- not the Apache Software License?</a>
- </li>
+ <li><a href="#why_lgpl">Why is logback distributed under LGPL
+ and not the Apache Software License?</a> </li>
<li><a href="#dependecy">What are logback's dependencies, i.e.
JDK version and third-party libraries?</a>
@@ -86,24 +85,30 @@
<h2>Logback project</h2>
<dl>
- <dt>
- <a name="why_lgpl" href="#why_lgpl">Why is logback distributed
- under LGPL and not the Apache Software License?</a>
- </dt>
+ <dt>
+ <a name="why_lgpl" href="#why_lgpl">Why is logback
+ distributed under LGPL and not the Apache Software License
+ (ASL)?</a> </dt>
<dd>
- <p>The logback project is distributed under the LGPL license
- in order to emphasize the fact that it is a related but
- <em>different</em> project than log4j.
+ <p>The logback project is dual licensed under the LGPL and
+ the EPL for two mains reasons. For one, the different
+ license emphasizes that the fact that logback is a related
+ but <em>different</em> project than log4j.
</p>
- <p>Given that Java v7 will be distributed under GPL, we expect
- GPL and LGPL to become even more prevalent in the Java world.
+ <p>Both the LGPL and EPL are reasonable and widely-accepted
+ licenses. In contrast to the ASL, both the LGPL and he EPL
+ require that derivate work be licensed under the same
+ license. While there might be debate about the exact
+ definition of derivative work, we find such reciprocity both
+ justified and morally appealing -- that tis the second
+ reason for our choice of the LGPL & EPL
+ dual-license. The subtly more liberal approach embodied in
+ the ASL is not necessarily wrong. It is the expression of a
+ different balance.
</p>
- <p>In short, LGPL is a reasonable and widely-accepted
- license. Let well alone.
- </p>
</dd>
</dl>
diff --git a/logback-site/src/site/pages/manual/layouts.html b/logback-site/src/site/pages/manual/layouts.html
index 7021214..f91d654 100644
--- a/logback-site/src/site/pages/manual/layouts.html
+++ b/logback-site/src/site/pages/manual/layouts.html
@@ -88,7 +88,7 @@
<div class="source">10489 DEBUG [main] com.marsupial.Pouch - Hello world.</div>
<p>Here is a possible implementation, authored by the Texan developer:</p>
- <em>Example 5.0: Sample implementation of a Layout
+ <em>Example: Sample implementation of a Layout
<a href="../xref/chapters/layouts/MySampleLayout.html">
(logback-examples/src/main/java/chapters/layouts/MySampleLayout.java)</a></em>
@@ -328,7 +328,7 @@ public class MySampleLayout2 extends LayoutBase<ILoggingEvent> {
<em>
- Example 5.1: Sample usage of a PatternLayout
+ Example: Sample usage of a PatternLayout
<a href="../xref/chapters/layouts/PatternSample.html">
(logback-examples/src/main/java/chapters/layouts/PatternSample.java)</a>
</em>
@@ -1271,7 +1271,7 @@ Caller+2 at mainPackage.ConfigTester.main(ConfigTester.java:38)</pre>
document.</p>
<em>
- Example 5.2: Sample usage of EventEvaluators
+ Example: Sample usage of EventEvaluators
(logback-examples/src/main/java/chapters/layouts/callerEvaluatorConfig.xml)
</em>
<pre class="prettyprint source"><configuration>
@@ -1303,7 +1303,7 @@ Caller+2 at mainPackage.ConfigTester.main(ConfigTester.java:38)</pre>
mentioned in above configuration file.</p>
<p><em>
- Example 5.2: Sample usage of EventEvaluators
+ Example: Sample usage of EventEvaluators
<a href="../xref/chapters/layouts/CallerEvaluatorExample.html">
(logback-examples/src/main/java/chapters/layouts/CallerEvaluatorExample.java)</a>
</em>
@@ -1397,7 +1397,7 @@ Caller+0 at chapters.layouts.CallerEvaluatorExample.main(CallerEvaluatorExampl
printed.</p>
<p><em>
- Example 5.2: Sample usage of EventEvaluators
+ Example: Sample usage of EventEvaluators
<a href="../xref/chapters/layouts/ExceptionEvaluatorExample.html">
(logback-examples/src/main/java/chapters/layouts/ExceptionEvaluatorExample.java)</a>
</em>
@@ -1446,7 +1446,7 @@ public class ExceptionEvaluatorExample {
</p>
<em>
- Example 5.3: Sample usage of EventEvaluators
+ Example: Sample usage of EventEvaluators
(logback-examples/src/main/java/chapters/layouts/exceptionEvaluatorConfig.xml)
</em>
<pre class="prettyprint source"><configuration>
@@ -1527,7 +1527,7 @@ java.lang.Exception: display
colors the level of the logging event, according to ANSI terminal
conventions. Here is a possible implementation:</p>
-<em> Example 5.4: Sample Converter Example
+<em> Example: Sample Converter Example
<a href="../xref/chapters/layouts/MySampleConverter.html">
(src/main/java/chapters/layouts/MySampleConverter.java)</a></em>
<pre class="prettyprint source">package chapters.layouts;
@@ -1580,7 +1580,7 @@ public class MySampleConverter extends ClassicConverter {
<code>Converter</code>. For this purpose, we need to declare the
new conversion word in the configuration file, as shown below:</p>
-<em> Example 5.4: Sample Converter Example (src/main/java/chapters/layouts/mySampleConverterConfig.xml)</em>
+<em> Example: Sample Converter Example (src/main/java/chapters/layouts/mySampleConverterConfig.xml)</em>
<pre class="prettyprint source"><configuration>
<b><conversionRule conversionWord="sample"
@@ -1663,6 +1663,7 @@ public class MySampleConverter extends ClassicConverter {
the use of <code>HTMLLayout</code>.
</p>
+<em> Example: HTMLLayout Example (src/main/java/chapters/layouts/htmlLayoutConfig1.xml)</em>
<pre class="prettyprint source"><configuration debug="true">
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
@@ -1679,29 +1680,12 @@ public class MySampleConverter extends ClassicConverter {
</configuration>
</pre>
- <p>The next application logs a few messages finishing with an
- exception.</p>
-
- <pre class="prettyprint source">import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TrivialMain {
- public static void main(String[] args) throws InterruptedException {
- Logger logger = LoggerFactory.getLogger(TrivialMain.class);
- for(int i = 0; i < 6; i ++) {
- if(i % 5 == 0) {
- logger.warn("a warning message "+i);
- } else {
- logger.debug("hello world number" +i);
- }
- }
- logger.error("Finish off with fireworks", new Exception("Just testing"));
- }
-}</pre>
+ <p>The <a
+ href="../xref/chapters/layouts/TrivialMain.html">TrivialMain</a>
+ application logs a few messages finishing with an exception. The
+ commmand:</p>
- <p>The command</p>
-
- <p class="source">java chapters.layouts.TrivialMain src/main/java/chapters/appenders/conf/logback-HtmlToConsole.xml</p>
+ <p class="source">java chapters.layouts.TrivialMain src/main/java/chapters/layouts/htmlLayoutConfig1.xml</p>
<p>will create the file <em>test.html</em> in the current
folder. The contents of <em>test.html</em> should be similar to:
@@ -1750,64 +1734,19 @@ public class TrivialMain {
<code><layout></code> element, as shown below.
</p>
-<pre class="prettyprint source"><layout>
- ...
+<pre class="prettyprint source"><layout class="ch.qos.logback.classic.html.HTMLLayout">
+ <pattern>%relative...%msg</pattern>
<cssBuilder class="ch.qos.logback.core.html.UrlCssBuilder">
- <url>path_to_StyleFile.css</url>
+ <!-- url where the css file is located -->
+ <url>http://...</url>
</cssBuilder>
- ...
</layout></pre>
<p>The <code>HTMLLayout</code> is often used in conjunction with
- <code>SMTPAppender</code>, in order to send an email pleasantly
- formatted in HTML. Here is a typical configuration:
+ <code>SMTPAppender</code> so that outgoing email is pleasantly
+ formatted in HTML.
</p>
-
- <pre class="prettyprint source"><configuration>
- <appender name="SMTP" class="ch.qos.logback.classic.net.SMTPAppender">
- <layout class="ch.qos.logback.classic.html.HTMLLayout">
- <pattern>%relative%thread%mdc%level%class%msg</pattern>
- </layout>
- <From>sender.email(a)domain.net</From>
- <SMTPHost>mail.domain.net</SMTPHost>
- <Subject>LastEvent: %class - %msg </Subject>
- <To>destination.email(a)domain.net</To>
- </appender>
-
- <root level="debug">
- <appender-ref ref="SMTP" />
- </root>
-</configuration></pre>
-
- <p><code>HTMLLayout</code> can also be used with any
- <code>FileAppender</code>, including a a rolling file appender, as
- shown in the sample configuration below.
- </p>
-
- <pre class="prettyprint source"><configuration>
- <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>lastLogEntries.html</file>
- <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
- <fileNamePattern>logEntries.%d{yyyy-MM-dd}.log</fileNamePattern>
- </rollingPolicy>
-
- <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
- <layout class="ch.qos.logback.classic.html.HTMLLayout">
- <cssBuilder class="ch.qos.logback.core.html.UrlCssBuilder">
- <url>address_of_a_custom_stylesheet.css</url>
- </cssBuilder>
- <pattern>%relative%thread%mdc%level%logger%msg</pattern>
- <b><title>Logging Events</title></b>
- </layout>
- </encoder>
- </appender>
-
- <root level="DEBUG">
- <appender-ref ref="FILE" />
- </root>
-</configuration></pre>
-
<h2><a name="log4jXMLLayout" href="#log4jXMLLayout">Log4j
XMLLayout</a></h2>
@@ -1815,8 +1754,7 @@ public class TrivialMain {
<p><a
href="../xref/ch/qos/logback/classic/log4j/XMLLayout.html">XMLLayout</a>
(part of logback-classic) generates output in a log4j.dtd
- compliant format. It can be used to inter-operate with tools such
- as <a
+ compliant format to interoperate with tools such as <a
href="http://logging.apache.org/chainsaw/index.html">Chainsaw</a>
and <a href="http://vigilog.sourceforge.net/">Vigilog</a> capable
of processing files generated by <a
@@ -1837,6 +1775,7 @@ public class TrivialMain {
<p>Here is a sample configuration</p>
+<em> Example: Log4jXMLLayout Example (src/main/java/chapters/layouts/log4jXMLLayout.xml)</em>
<pre class="prettyprint source"><configuration>
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>test.xml</file>
@@ -1852,7 +1791,7 @@ public class TrivialMain {
</root>
</configuration> </pre>
- <h2>Logback access</h2>
+ <h1><a name="logback-access" href="#logback-access">Logback access</a></h1>
<p>Most logback-access layouts are mere adaptations of
logback-classic layouts. Logback-classic and logback-access
-----------------------------------------------------------------------
Summary of changes:
.../ch/qos/logback/core/html/HTMLLayoutBase.java | 6 +-
.../{htmlLayoutConfig1.xml => log4jXMLLayout.xml} | 12 +-
logback-site/src/site/pages/faq.html | 35 ++++---
logback-site/src/site/pages/manual/layouts.html | 107 ++++---------------
4 files changed, 50 insertions(+), 110 deletions(-)
copy logback-examples/src/main/java/chapters/layouts/{htmlLayoutConfig1.xml => log4jXMLLayout.xml} (54%)
hooks/post-receive
--
Logback: the generic, reliable, fast and flexible logging framework.
1
0

[JIRA] Created: (LBCORE-142) Logging EOFException differs from EOFException.printStackTrace()
by Gili (JIRA) 12 Mar '10
by Gili (JIRA) 12 Mar '10
12 Mar '10
Logging EOFException differs from EOFException.printStackTrace()
----------------------------------------------------------------
Key: LBCORE-142
URL: http://jira.qos.ch/browse/LBCORE-142
Project: logback-core
Issue Type: Bug
Environment: java 1.6
logback 0.9.18
slf4j 1.5.11
Reporter: Gili
Assignee: Logback dev list
Priority: Minor
Given: e = EOFException, if I run e.printStackTrace() I get:
java.io.EOFException
at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2281)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2750)
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:780)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:280)
When I log this same exception under Logback I get:
java.io.EOFException: null
at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2281) [na:1.6.0_18]
at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2750) [na:1.6.0_18]
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:780) [na:1.6.0_18]
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:280) [na:1.6.0_18]
I see two problems with the logback version:
# It prints "null" after EOFException when an exception message is not set. I am expecting the same output as printStackTrace()
# It is missing debugging information (file and line numbers) as seen in printStackTrace()
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
2
3

[GIT] Logback: the generic, reliable, fast and flexible logging framework. branch, master, updated. v0.9.18-78-g7ffb4f8
by git-noreply@pixie.qos.ch 11 Mar '10
by git-noreply@pixie.qos.ch 11 Mar '10
11 Mar '10
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 7ffb4f83eb56a595d6757c58aae0812d2686ac4d (commit)
from c7af050b93defa5beb51c3d031ddcf85909719d7 (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=7ffb4f83eb56a595d6757c58…
http://github.com/ceki/logback/commit/7ffb4f83eb56a595d6757c58aae0812d2686a…
commit 7ffb4f83eb56a595d6757c58aae0812d2686ac4d
Author: Ceki Gulcu <ceki(a)qos.ch>
Date: Thu Mar 11 23:15:53 2010 +0100
- improving the docs
diff --git a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeTest.java b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeTest.java
index 58851ac..ac2d714 100644
--- a/logback-classic/src/test/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeTest.java
+++ b/logback-classic/src/test/java/ch/qos/logback/classic/turbo/ReconfigureOnChangeTest.java
@@ -153,9 +153,9 @@ public class ReconfigureOnChangeTest {
// however, there should be some effective resets
String failMsg = "effective=" + effectiveResets + ", expected="
+ expectedReconfigurations;
-
- //
- if (!(Env.isJDK6OrHigher())) {
+
+ // we can't have the test succeed under JDK 1.5, punt and require 1.6+
+ if (Env.isJDK6OrHigher()) {
assertTrue(failMsg,
(effectiveResets * 1.3) >= (expectedReconfigurations * 1.0));
}
diff --git a/logback-core/src/main/java/ch/qos/logback/core/encoder/LayoutWrappingEncoder.java b/logback-core/src/main/java/ch/qos/logback/core/encoder/LayoutWrappingEncoder.java
index 32ea60d..00de2e3 100644
--- a/logback-core/src/main/java/ch/qos/logback/core/encoder/LayoutWrappingEncoder.java
+++ b/logback-core/src/main/java/ch/qos/logback/core/encoder/LayoutWrappingEncoder.java
@@ -93,7 +93,7 @@ public class LayoutWrappingEncoder<E> extends EncoderBase<E> {
return s.getBytes(charset.name());
} catch (UnsupportedEncodingException e) {
throw new IllegalStateException(
- "An existing charser cannot possibly be unsupported.");
+ "An existing charset cannot possibly be unsupported.");
}
}
}
diff --git a/logback-examples/src/main/java/chapters/appenders/conf/logback-HtmlToConsole.xml b/logback-examples/src/main/java/chapters/appenders/conf/logback-HtmlToConsole.xml
index a762945..2e3fd77 100644
--- a/logback-examples/src/main/java/chapters/appenders/conf/logback-HtmlToConsole.xml
+++ b/logback-examples/src/main/java/chapters/appenders/conf/logback-HtmlToConsole.xml
@@ -1,15 +1,17 @@
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <encoder class="ch.qos.logback.classic.html.HTMLLayout">
- <cssBuilder class="ch.qos.logback.core.helpers.CssBuilder">
- <url>path_to_StyleFile.css</url>
- </cssBuilder>
- <Pattern>%-4relative [%thread] %-5level - %msg%n</Pattern>
+ <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
+ <layout class="ch.qos.logback.classic.html.HTMLLayout">
+ <cssBuilder class="ch.qos.logback.classic.html.UrlCssBuilder">
+ <url>path_to_StyleFile.css</url>
+ </cssBuilder>
+ <pattern>%-4relative [%thread] %-5level - %msg%n</pattern>
+ </layout>
</encoder>
</appender>
- <root level="debug">
+ <root level="DEBUG">
<appender-ref ref="STDOUT" />
</root>
</configuration>
diff --git a/logback-examples/src/main/java/chapters/filters/levelFilterConfig.xml b/logback-examples/src/main/java/chapters/filters/levelFilterConfig.xml
index 9b514f9..f99902f 100644
--- a/logback-examples/src/main/java/chapters/filters/levelFilterConfig.xml
+++ b/logback-examples/src/main/java/chapters/filters/levelFilterConfig.xml
@@ -7,9 +7,9 @@
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
- <layout class="ch.qos.logback.classic.PatternLayout">
+ <encoder>
<pattern>%-4relative [%thread] %-5level %logger{30} - %msg%n</pattern>
- </layout>
+ </encoder>
</appender>
<root level="DEBUG">
<appender-ref ref="CONSOLE" />
diff --git a/logback-examples/src/main/java/chapters/filters/sampleFilterConfig.xml b/logback-examples/src/main/java/chapters/filters/sampleFilterConfig.xml
index 203b247..b13389a 100644
--- a/logback-examples/src/main/java/chapters/filters/sampleFilterConfig.xml
+++ b/logback-examples/src/main/java/chapters/filters/sampleFilterConfig.xml
@@ -1,14 +1,13 @@
<configuration>
- <appender name="STDOUT"
- class="ch.qos.logback.core.ConsoleAppender">
- <Filter class="chapters.filters.SampleFilter" />
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <filter class="chapters.filters.SampleFilter" />
- <layout class="ch.qos.logback.classic.PatternLayout">
+ <encoder>
<pattern>
%-4relative [%thread] %-5level %logger - %msg%n
</pattern>
- </layout>
+ </encoder>
</appender>
<root>
diff --git a/logback-examples/src/main/java/chapters/filters/thresholdFilterConfig.xml b/logback-examples/src/main/java/chapters/filters/thresholdFilterConfig.xml
index f7a38b8..294b017 100644
--- a/logback-examples/src/main/java/chapters/filters/thresholdFilterConfig.xml
+++ b/logback-examples/src/main/java/chapters/filters/thresholdFilterConfig.xml
@@ -7,9 +7,9 @@
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
- <layout>
+ <encoder>
<pattern>%-4relative [%thread] %-5level %logger{30} - %msg%n</pattern>
- </layout>
+ </encoder>
</appender>
diff --git a/logback-examples/src/main/java/chapters/layouts/ExceptionEvaluatorExample.java b/logback-examples/src/main/java/chapters/layouts/ExceptionEvaluatorExample.java
index fac16d7..4fc375f 100644
--- a/logback-examples/src/main/java/chapters/layouts/ExceptionEvaluatorExample.java
+++ b/logback-examples/src/main/java/chapters/layouts/ExceptionEvaluatorExample.java
@@ -33,10 +33,12 @@ public class ExceptionEvaluatorExample {
lc.reset();
configurator.doConfigure(args[0]);
} catch (JoranException je) {
- StatusPrinter.print(lc);
+ // StatusPrinter will handle this
}
- for (int i = 0; i < 5; i++) {
- if (i == 3) {
+ StatusPrinter.printInCaseOfErrorsOrWarnings(lc);
+
+ for (int i = 0; i < 3; i++) {
+ if (i == 1) {
logger.debug("logging statement " + i, new TestException(
"do not display this"));
} else {
diff --git a/logback-examples/src/main/java/chapters/layouts/SampleLogging.java b/logback-examples/src/main/java/chapters/layouts/SampleLogging.java
index 5e7d55c..fe0b8de 100644
--- a/logback-examples/src/main/java/chapters/layouts/SampleLogging.java
+++ b/logback-examples/src/main/java/chapters/layouts/SampleLogging.java
@@ -23,15 +23,19 @@ import ch.qos.logback.core.util.StatusPrinter;
public class SampleLogging {
- public static void main(String[] args) throws JoranException {
+ public static void main(String[] args) {
Logger logger = LoggerFactory.getLogger(SampleLogging.class);
LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
- JoranConfigurator configurator = new JoranConfigurator();
- lc.reset();
- configurator.setContext(lc);
- configurator.doConfigure(args[0]);
+ try {
+ JoranConfigurator configurator = new JoranConfigurator();
+ lc.reset();
+ configurator.setContext(lc);
+ configurator.doConfigure(args[0]);
+ } catch (JoranException je) {
+ // StatusPrinter will handle this
+ }
StatusPrinter.printInCaseOfErrorsOrWarnings(lc);
logger.debug("Everything's going well");
diff --git a/logback-examples/src/main/java/chapters/layouts/ExceptionEvaluatorExample.java b/logback-examples/src/main/java/chapters/layouts/TrivialMain.java
similarity index 51%
copy from logback-examples/src/main/java/chapters/layouts/ExceptionEvaluatorExample.java
copy to logback-examples/src/main/java/chapters/layouts/TrivialMain.java
index fac16d7..ff0dcbe 100644
--- a/logback-examples/src/main/java/chapters/layouts/ExceptionEvaluatorExample.java
+++ b/logback-examples/src/main/java/chapters/layouts/TrivialMain.java
@@ -1,15 +1,15 @@
/**
* Logback: the reliable, generic, fast and flexible logging framework.
- * Copyright (C) 1999-2009, QOS.ch. All rights reserved.
- *
- * This program and the accompanying materials are dual-licensed under
- * either the terms of the Eclipse Public License v1.0 as published by
- * the Eclipse Foundation
- *
- * or (per the licensee's choosing)
- *
- * under the terms of the GNU Lesser General Public License version 2.1
- * as published by the Free Software Foundation.
+ * Copyright (C) 1999-2010, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under either
+ * the terms of the Eclipse Public License v1.0 as published by the Eclipse
+ * Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1 as
+ * published by the Free Software Foundation.
*/
package chapters.layouts;
@@ -21,27 +21,28 @@ 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 = LoggerFactory.getLogger(ExceptionEvaluatorExample.class);
+public class TrivialMain {
+ public static void main(String[] args) throws InterruptedException {
+ Logger logger = LoggerFactory.getLogger(TrivialMain.class);
LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
-
+
try {
JoranConfigurator configurator = new JoranConfigurator();
configurator.setContext(lc);
lc.reset();
configurator.doConfigure(args[0]);
} catch (JoranException je) {
- StatusPrinter.print(lc);
+ // StatusPrinter will handle this
}
- for (int i = 0; i < 5; i++) {
- if (i == 3) {
- logger.debug("logging statement " + i, new TestException(
- "do not display this"));
+ StatusPrinter.printInCaseOfErrorsOrWarnings(lc);
+
+ for (int i = 0; i < 6; i++) {
+ if (i % 5 == 0) {
+ logger.warn("a warning message " + i);
} else {
- logger.debug("logging statement " + i, new Exception("display"));
+ logger.debug("hello world number" + i);
}
}
+ logger.error("Finish off with fireworks", new Exception("Just testing"));
}
}
\ No newline at end of file
diff --git a/logback-examples/src/main/java/chapters/layouts/exceptionEvaluatorConfig.xml b/logback-examples/src/main/java/chapters/layouts/exceptionEvaluatorConfig.xml
index 1f51577..7643768 100644
--- a/logback-examples/src/main/java/chapters/layouts/exceptionEvaluatorConfig.xml
+++ b/logback-examples/src/main/java/chapters/layouts/exceptionEvaluatorConfig.xml
@@ -1,16 +1,16 @@
<configuration>
<evaluator name="DISPLAY_EX_EVAL">
- <Expression>throwable != null && throwable instanceof chapters.layouts.TestException</Expression>
+ <expression>throwable != null && throwable instanceof chapters.layouts.TestException</expression>
</evaluator>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <layout class="ch.qos.logback.classic.PatternLayout">
- <Pattern>%-4relative [%thread] %-5level - %msg%n%ex{full, DISPLAY_EX_EVAL}</Pattern>
- </layout>
+ <encoder>
+ <pattern>%msg%n%xEx{full, DISPLAY_EX_EVAL}</pattern>
+ </encoder>
</appender>
- <root level="debug">
+ <root level="DEBUG">
<appender-ref ref="STDOUT" />
</root>
</configuration>
\ No newline at end of file
diff --git a/logback-examples/src/main/java/chapters/layouts/htmlLayoutConfig1.xml b/logback-examples/src/main/java/chapters/layouts/htmlLayoutConfig1.xml
new file mode 100644
index 0000000..3dfd5b6
--- /dev/null
+++ b/logback-examples/src/main/java/chapters/layouts/htmlLayoutConfig1.xml
@@ -0,0 +1,14 @@
+<configuration>
+ <appender name="FILE" class="ch.qos.logback.core.FileAppender">
+ <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
+ <layout class="ch.qos.logback.classic.html.HTMLLayout">
+ <pattern>%relative%thread%mdc%level%logger%msg</pattern>
+ </layout>
+ </encoder>
+ <file>test.html</file>
+ </appender>
+
+ <root level="DEBUG">
+ <appender-ref ref="FILE" />
+ </root>
+</configuration>
\ No newline at end of file
diff --git a/logback-examples/src/main/java/chapters/layouts/mySampleConverterConfig.xml b/logback-examples/src/main/java/chapters/layouts/mySampleConverterConfig.xml
index 048eb24..bcc3c14 100644
--- a/logback-examples/src/main/java/chapters/layouts/mySampleConverterConfig.xml
+++ b/logback-examples/src/main/java/chapters/layouts/mySampleConverterConfig.xml
@@ -1,15 +1,15 @@
<configuration>
- <conversionRule conversionWord="sample" converterClass="chapters.layouts.MySampleConverter" />
+ <conversionRule conversionWord="sample"
+ converterClass="chapters.layouts.MySampleConverter" />
- <appender name="STDOUT"
- class="ch.qos.logback.core.ConsoleAppender">
- <layout class="ch.qos.logback.classic.PatternLayout">
- <Pattern>%-4relative [%thread] %sample - %msg%n</Pattern>
- </layout>
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>%-4relative [%thread] %sample - %msg%n</pattern>
+ </encoder>>
</appender>
- <root level="debug">
+ <root level="DEBUG">
<appender-ref ref="STDOUT" />
</root>
</configuration>
\ No newline at end of file
diff --git a/logback-site/src/site/pages/manual/filters.html b/logback-site/src/site/pages/manual/filters.html
index b61a452..82ca505 100644
--- a/logback-site/src/site/pages/manual/filters.html
+++ b/logback-site/src/site/pages/manual/filters.html
@@ -132,13 +132,13 @@ public class SampleFilter extends Filter>ILoggingEvent> {
<pre class="prettyprint source"><configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <b><Filter class="chapters.filters.SampleFilter" /></b>
+ <b><filter class="chapters.filters.SampleFilter" /></b>
- <layout class="ch.qos.logback.classic.PatternLayout">
+ <encoder>
<pattern>
%-4relative [%thread] %-5level %logger - %msg%n
</pattern>
- </layout>
+ </encoder>
</appender>
<root>
@@ -185,18 +185,17 @@ public class SampleFilter extends Filter>ILoggingEvent> {
<em>Example 6.<span class="autoEx"/>: Sample LevelFilter configuration (logback-examples/src/main/java/chapters/filters/levelFilterConfig.xml)</em>
<pre class="prettyprint source"><configuration>
- <appender name="CONSOLE"
- class="ch.qos.logback.core.ConsoleAppender">
+ <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<b><filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>INFO</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter></b>
- <layout>
+ <encoder>
<pattern>
%-4relative [%thread] %-5level %logger{30} - %msg%n
</pattern>
- </layout>
+ </encoder>
</appender>
<root level="DEBUG">
<appender-ref ref="CONSOLE" />
@@ -223,11 +222,11 @@ public class SampleFilter extends Filter>ILoggingEvent> {
<b><filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter></b>
- <layout>
+ <encoder>
<pattern>
%-4relative [%thread] %-5level %logger{30} - %msg%n
</pattern>
- </layout>
+ </encoder>
</appender>
<root level="DEBUG">
<appender-ref ref="CONSOLE" />
@@ -401,8 +400,7 @@ public class SampleFilter extends Filter>ILoggingEvent> {
<pre class="prettyprint source longline"><configuration>
- <appender name="STDOUT"
- class="ch.qos.logback.core.ConsoleAppender">
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<b><filter class="ch.qos.logback.core.filter.EvaluatorFilter">
<evaluator> <!-- defaults to type ch.qos.logback.classic.boolex.JaninoEventEvaluator -->
<expression><span class="green">message.contains("billing")</span></expression>
@@ -410,11 +408,11 @@ public class SampleFilter extends Filter>ILoggingEvent> {
<OnMismatch>NEUTRAL</OnMismatch>
<OnMatch>DENY</OnMatch>
</filter></b>
- <layout>
+ <encoder>
<pattern>
%-4relative [%thread] %-5level %logger - %msg%n
</pattern>
- </layout>
+ </encoder>
</appender>
<root level="INFO">
@@ -524,9 +522,9 @@ java chapters.filters.FilterEvents src/main/java/chapters/filters/basicConfigura
<OnMismatch>NEUTRAL</OnMismatch>
<OnMatch>DENY</OnMatch>
</filter>
- <layout>
+ <encoder>
<pattern>%-4relative [%thread] %-5level %logger - %msg%n</pattern>
- </layout>
+ </encoder>
</appender>
<root level="DEBUG">
@@ -662,13 +660,12 @@ public class SampleTurboFilter extends TurboFilter {
<Marker>sample</Marker>
</turboFilter></b>
- <appender name="STDOUT"
- class="ch.qos.logback.core.ConsoleAppender">
- <layout class="ch.qos.logback.classic.PatternLayout">
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
<pattern>
%-4relative [%thread] %-5level %logger - %msg%n
</pattern>
- </layout>
+ </encoder>
</appender>
<root>
@@ -708,12 +705,12 @@ configuration (logback-examples/src/main/java/chapters/filters/turboFilters.xml)
</turboFilter>
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
- <layout class="ch.qos.logback.classic.PatternLayout">
- <Pattern>%date [%thread] %-5level %logger - %msg%n</Pattern>
- </layout>
+ <encoder>
+ <pattern>%date [%thread] %-5level %logger - %msg%n</pattern>
+ </encoder>
</appender>
- <root level="info">
+ <root level="INFO">
<appender-ref ref="console" />
</root>
</configuration></pre>
@@ -826,12 +823,12 @@ configuration (logback-examples/src/main/java/chapters/filters/duplicateMessage.
<b><turboFilter class="ch.qos.logback.classic.turbo.DuplicateMessageFilter"/></b>
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
- <layout class="ch.qos.logback.classic.PatternLayout">
- <Pattern>%date [%thread] %-5level %logger - %msg%n</Pattern>
- </layout>
+ <encoder>
+ <pattern>%date [%thread] %-5level %logger - %msg%n</pattern>
+ </encoder>
</appender>
- <root level="info">
+ <root level="INFO">
<appender-ref ref="console" />
</root>
</configuration></pre>
@@ -897,20 +894,19 @@ configuration (logback-examples/src/main/java/chapters/filters/duplicateMessage.
<em>Example 6.<span class="autoEx"/>: Access Evaluator (logback-examples/src/main/java/chapters/filters/accessEventEvaluator.xml)</em>
<pre class="prettyprint source"><configuration>
- <appender name="STDOUT"
- class="ch.qos.logback.core.ConsoleAppender">
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<b><filter class="ch.qos.logback.core.filter.EvaluatorFilter">
<evaluator name="myEval">
<expression>event.getStatusCode() == 404</expression>
</evaluator>
- <OnMismatch>NEUTRAL</OnMismatch>
- <OnMatch>ACCEPT</OnMatch>
+ <onMismatch>NEUTRAL</onMismatch>
+ <onMatch>ACCEPT</onMatch>
</filter></b>
- <layout class="ch.qos.logback.access.PatternLayout">
+ <encoder>
<pattern>
%h %l %u %t %r %s %b
</pattern>
- </layout>
+ </encoder>
</appender>
<appender-ref ref="STDOUT" />
@@ -924,27 +920,26 @@ configuration (logback-examples/src/main/java/chapters/filters/duplicateMessage.
<em>Example 6.10: Access Evaluator (logback-examples/src/main/java/chapters/filters/accessEventEvaluator2.xml)</em>
<pre class="prettyprint source"><configuration>
- <appender name="STDOUT"
- class="ch.qos.logback.core.ConsoleAppender">
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<b><filter class="ch.qos.logback.core.filter.EvaluatorFilter">
<evaluator name="Eval404">
<expression>event.getStatusCode() == 404</expression>
</evaluator>
- <OnMismatch>NEUTRAL</OnMismatch>
- <OnMatch>ACCEPT</OnMatch>
+ <onMismatch>NEUTRAL</onMismatch>
+ <onMatch>ACCEPT</onMatch>
</filter>
<filter class="ch.qos.logback.core.filter.EvaluatorFilter">
<evaluator name="EvalCSS">
<expression>event.getRequestURI().contains("css")</expression>
</evaluator>
- <OnMismatch>NEUTRAL</OnMismatch>
- <OnMatch>DENY</OnMatch>
+ <onMismatch>NEUTRAL</onMismatch>
+ <onMatch>DENY</onMatch>
</filter></b>
- <layout class="ch.qos.logback.access.PatternLayout">
+ <encoder>
<pattern>
%h %l %u %t %r %s %b
</pattern>
- </layout>
+ </encoder>
</appender>
<appender-ref ref="STDOUT" />
diff --git a/logback-site/src/site/pages/manual/layouts.html b/logback-site/src/site/pages/manual/layouts.html
index 25ffd9b..7021214 100644
--- a/logback-site/src/site/pages/manual/layouts.html
+++ b/logback-site/src/site/pages/manual/layouts.html
@@ -848,6 +848,7 @@ Caller+2 at mainPackage.ConfigTester.main(ConfigTester.java:38)</pre>
<tr class="alt">
<td align="center">
+ <a name="xThrowable" href="#xThrowable">
<b>xEx</b>{<em>length</em>} <br />
<b>xException</b>{<em>length</em>} <br />
<b>xThrowable</b>{<em>length</em>} <br />
@@ -855,6 +856,7 @@ Caller+2 at mainPackage.ConfigTester.main(ConfigTester.java:38)</pre>
<b>xEx</b>{length, evaluator-1, ..., evaluator-n} <br />
<b>xException</b>{length, evaluator-1, ..., evaluator-n} <br />
<b>xThrowable</b>{length, evaluator-1, ..., evaluator-n}
+ </a>
</td>
<td>
@@ -1274,27 +1276,31 @@ Caller+2 at mainPackage.ConfigTester.main(ConfigTester.java:38)</pre>
</em>
<pre class="prettyprint source"><configuration>
<b><evaluator name="DISP_CALLER_EVAL">
- <Expression>logger.getName().contains("chapters.layouts") &amp;&amp; \
- message.contains("who calls thee")</Expression>
+ <expression>logger.contains("chapters.layouts") &amp;&amp; \
+ message.contains("who calls thee")</expression>
</evaluator></b>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <layout class="ch.qos.logback.classic.PatternLayout">
- <Pattern>%-4relative [%thread] %-5level - %msg%n<b>%caller{2, DISP_CALLER_EVAL}</b>
- </Pattern>
- </layout>
+ <encoder>
+ <pattern>
+ %-4relative [%thread] %-5level - %msg%n<b>%caller{2, DISP_CALLER_EVAL}</b>
+ </pattern>
+ </encoder>
</appender>
- <root level="debug">
+ <root level="DEBUG">
<appender-ref ref="STDOUT" />
</root>
</configuration></pre>
- <p>Due to XML encoding rules, the & character cannot be
- written as is, and needs to be escaped as &amp;.</p>
+ <p>The above evaluation expression matches events which emanate
+ from logger with a name containing the string "chapters.layouts"
+ and the message containing the string "who calls thee". Due to XML
+ encoding rules, the & character cannot be written as is, and
+ needs to be escaped as &amp;.</p>
- <p>The above configuration file is designed to be accompanied by
- the following custom-tailored code.</p>
+ <p>The following class makes use of some of the characteristics
+ mentioned in above configuration file.</p>
<p><em>
Example 5.2: Sample usage of EventEvaluators
@@ -1302,7 +1308,7 @@ Caller+2 at mainPackage.ConfigTester.main(ConfigTester.java:38)</pre>
(logback-examples/src/main/java/chapters/layouts/CallerEvaluatorExample.java)</a>
</em>
</p>
- <pre class="prettyprint source">package chapters.layouts;
+ <pre class="prettyprint source">package <b>chapters.layouts</b>;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -1329,7 +1335,7 @@ public class CallerEvaluatorExample {
for (int i = 0; i < 5; i++) {
if (i == 3) {
- logger.debug("who calls thee?");
+ logger.debug(<b>"who calls thee</b>?");
} else {
logger.debug("I know me " + i);
}
@@ -1337,14 +1343,9 @@ public class CallerEvaluatorExample {
}
}</pre>
- <p>The <em>CallerEvaluatorExample</em> application does nothing
- particularly fancy. Five logging requests are issued, the third
- one being different from the others.
- </p>
-
- <p>When a logging request is issued, the corresponding logging
- event is evaluated. The third request matches the evaluation
- criteria, causing its caller data to be displayed.
+ <p>The above application does nothing particularly fancy. Five
+ logging requests are issued, the third one emitting the message
+ "who calls theee?"
</p>
<p>The command</p>
@@ -1360,6 +1361,15 @@ public class CallerEvaluatorExample {
Caller+0 at chapters.layouts.CallerEvaluatorExample.main(CallerEvaluatorExample.java:28)
0 [main] DEBUG - I know me 4</pre></div>
+
+ <p>When a logging request is issued, the corresponding logging
+ event is evaluated. Only the third logging event matches the
+ evaluation criteria, causing its caller data to be displayed. For
+ other logging events, the evaluation criteria do not match and no
+ caller data is printed.
+ </p>
+
+
<p>One can change the expression to correspond a real world
scenario. For instance, one could combine the logger name and
request level. Thus, logging requests of level <em>WARN</em> and
@@ -1368,19 +1378,23 @@ Caller+0 at chapters.layouts.CallerEvaluatorExample.main(CallerEvaluatorExampl
displayed.
</p>
- <p><b>Important:</b> With the <em>caller</em> conversion word, the
- data is displayed when <em>the expression evaluates to
+ <p><b>Important:</b> With the <em>caller</em> conversion word,
+ caller data is output when <em>the expression evaluates to
<b>true</b>.</em></p>
<p>Let us consider at a different situation. When exceptions are
- included in a logging request, their stack trace is usually
- displayed. However, in some cases, one might want to supress the
- stack trace of some specific exception.
+ included in a logging request, their stack trace is also
+ output. However, one might want to supress the stack trace for
+ some specific exceptions.
</p>
- <p>The java code shown below creates five log requests, each with
- an exception. However, it so happends that we do not wish the
- stack trace of the third request to be output.</p>
+ <p>The java code shown below creates three log requests, each with
+ an exception. The second exception different from the others
+ contains the string "do not display this" and conttrary to the
+ others it is of type
+ <code>chapters.layouts.TestException</code>. As its message
+ commands, let us now prevent the third exception from being
+ printed.</p>
<p><em>
Example 5.2: Sample usage of EventEvaluators
@@ -1407,12 +1421,15 @@ public class ExceptionEvaluatorExample {
try {
JoranConfigurator configurator = new JoranConfigurator();
configurator.setContext(lc);
+ lc.reset();
configurator.doConfigure(args[0]);
} catch (JoranException je) {
- StatusPrinter.print(lc);
+ // StatusPrinter will handle this
}
- for (int i = 0; i < 5; i++) {
- if (i == 3) {
+ StatusPrinter.printInCaseOfErrorsOrWarnings(lc);
+
+ for (int i = 0; i < 3; i++) {
+ if (i == 1) {
logger.debug("logging statement " + i, new TestException(
"do not display this"));
} else {
@@ -1422,8 +1439,12 @@ public class ExceptionEvaluatorExample {
}
}</pre>
- <p>The following configuration will supress the stack trace of the
- third logging request.</p>
+ <p>In the next configuration file, the evaluation expression
+ matches events containing a throwable of type
+ <code>chapters.layouts.TextException</code>, precisely the type of
+ exceptions we wish to supress.
+ </p>
+
<em>
Example 5.3: Sample usage of EventEvaluators
(logback-examples/src/main/java/chapters/layouts/exceptionEvaluatorConfig.xml)
@@ -1431,16 +1452,14 @@ public class ExceptionEvaluatorExample {
<pre class="prettyprint source"><configuration>
<b><evaluator name="DISPLAY_EX_EVAL">
- <Expression>throwable != null &amp;&amp; throwable instanceof \
- chapters.layouts.TestException</Expression>
+ <expression>throwable != null &amp;&amp; throwable instanceof \
+ chapters.layouts.TestException</expression>
</evaluator></b>
- <appender name="STDOUT"
- class="ch.qos.logback.core.ConsoleAppender">
- <layout class="ch.qos.logback.classic.PatternLayout">
- <Pattern>%-4relative [%thread] %-5level - %msg%n<b>%ex{full, DISPLAY_EX_EVAL}</b>
- </Pattern>
- </layout>
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder
+ <pattern>%msg%n<b>%ex{full, DISPLAY_EX_EVAL}</b></pattern>
+ </encoder>
</appender>
<root level="debug">
@@ -1453,18 +1472,41 @@ public class ExceptionEvaluatorExample {
request, the stack trace will be suppressed.
</p>
+ <p>Launching the command</p>
+
+ <p class="source">java chapters.layouts.ExceptionEvaluatorExample src/main/java/chapters/layouts/exceptionEvaluatorConfig.xml</p>
+
+ <p>will yield</p>
+
+<p class="source">logging statement 0
+java.lang.Exception: display
+ at chapters.layouts.ExceptionEvaluatorExample.main(ExceptionEvaluatorExample.java:43) [logback-examples-0.9.19.jar:na]
+logging statement 1
+logging statement 2
+java.lang.Exception: display
+ at chapters.layouts.ExceptionEvaluatorExample.main(ExceptionEvaluatorExample.java:43) [logback-examples-0.9.19.jar:na]</p>
+
+
+ <p>Notice how the second log statement has no stack trace. We
+ effectively supressed the stack trace for the
+ <code>TextException</code>. The text between square brackets at
+ the end of each stack trace line is <a
+ href="#xThrowable">packaging information</a> discussed
+ earlier.</p>
+
<p><b>Important:</b> With the <b><em>%ex</em></b> conversion
specifier, the stack trace is displayed when <em>the expression
evaluates to <b>false</b>.</em></p>
+
- <h3><a name="customConversionSpecifier"
+ <h2><a name="customConversionSpecifier"
href="#customConversionSpecifier">Creating a custom conversion
- specifier</a></h3>
+ specifier</a></h2>
- <p>Up to this point we have presented the built-inconversion
- specifiers of <code>PatternLayout</code>. But it is also possible
- to use a conversion specifier of your own making.</p>
+ <p>Up to this point we have presented the built-in conversion
+ words in <code>PatternLayout</code>. But it is also possible to
+ add conversion words of your own making.</p>
<p>Building a custom conversion specifier consists of two steps.
</p>
@@ -1541,24 +1583,24 @@ public class MySampleConverter extends ClassicConverter {
<em> Example 5.4: Sample Converter Example (src/main/java/chapters/layouts/mySampleConverterConfig.xml)</em>
<pre class="prettyprint source"><configuration>
- <b><conversionRule conversionWord="sample" converterClass="chapters.layouts.MySampleConverter" /></b>
+ <b><conversionRule conversionWord="sample"
+ converterClass="chapters.layouts.MySampleConverter" /></b>
- <appender name="STDOUT"
- class="ch.qos.logback.core.ConsoleAppender">
- <layout class="ch.qos.logback.classic.PatternLayout">
- <b><Pattern>%-4relative [%thread] %sample - %msg%n</Pattern></b>
- </layout>
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>%-4relative [%thread] <b>%sample</b> - %msg%n</pattern>
+ </encoder
</appender>
- <root level="debug">
+ <root level="DEBUG">
<appender-ref ref="STDOUT" />
</root>
</configuration></pre>
- <p>In this configuration file, once the new conversion word has
- been declared, we can refert to it within a
- <code>PatternLayout</code> pattern, as if the custom conversion
- word had always been here.</p>
+ <p>Once the new conversion word has been declared in the
+ configuration file, we can refer to it within
+ <code>PatternLayout</code> pattern, as with any other
+ conversion word.</p>
<p>Given that ANSI terminal codes do not work on Windows, you can
view the results on non-Windows platforms such as Linux or
@@ -1573,9 +1615,9 @@ public class MySampleConverter extends ClassicConverter {
<p>Please note that the string "ERROR" is highlighted in red,
- which was somewhat the point of the exercise.</p>
+ which was the declared intent of the exercise.</p>
- <p>The intersted reader might want to take a look at other
+ <p>The reader might want to take a look at other
<code>Converter</code> implementations such as
<a href="../xref/ch/qos/logback/classic/pattern/MDCConverter.html">
<code>MDCConverter</code></a> to learn about more complex
@@ -1584,9 +1626,9 @@ public class MySampleConverter extends ClassicConverter {
- <h3>
+ <h2>
<a name="ClassicHTMLLayout" href="#ClassicHTMLLayout">HTMLLayout</a>
- </h3>
+ </h2>
<p><a
href="../xref/ch/qos/logback/classic/html/HTMLLayout.html"><code>HTMLLayout</code></a>
@@ -1597,7 +1639,7 @@ public class MySampleConverter extends ClassicConverter {
<p>Here is a sample output produced by <code>HTMLLayout</code>
using its default CSS stylesheet:</p>
- <img src="images/htmlLayout0.gif" alt="HTML Layout Sample Image"/>
+ <img src="images/chapters/layouts/htmlLayout0.gif" alt="HTML Layout Sample Image"/>
<p>The content of table columns are specified with the help of a
conversion pattern. See <a
@@ -1623,21 +1665,23 @@ public class MySampleConverter extends ClassicConverter {
<pre class="prettyprint source"><configuration debug="true">
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
- <layout class="ch.qos.logback.classic.html.HTMLLayout">
- <b><pattern>%relative%thread%mdc%level%logger%msg</pattern></b>
- </layout>
- <File>/test.html</File>
+ <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
+ <layout class="ch.qos.logback.classic.html.HTMLLayout">
+ <b><pattern>%relative%thread%mdc%level%logger%msg</pattern></b>
+ </layout>
+ </encoder>
+ <file>test.html</file>
</appender>
- <root level="debug">
+ <root level="DEBUG">
<appender-ref ref="FILE" />
</root>
</configuration>
</pre>
- <p>Launching the <code>TrivialMain</code> application listed below
- will create the file <em>test.html</em> on your local drive.</p>
-
+ <p>The next application logs a few messages finishing with an
+ exception.</p>
+
<pre class="prettyprint source">import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -1646,7 +1690,7 @@ public class TrivialMain {
Logger logger = LoggerFactory.getLogger(TrivialMain.class);
for(int i = 0; i < 6; i ++) {
if(i % 5 == 0) {
- logger.info("an info message "+i);
+ logger.warn("a warning message "+i);
} else {
logger.debug("hello world number" +i);
}
@@ -1655,9 +1699,14 @@ public class TrivialMain {
}
}</pre>
- <p>The contents of <em>test.html</em> should be similar to:
+ <p>The command</p>
+
+ <p class="source">java chapters.layouts.TrivialMain src/main/java/chapters/appenders/conf/logback-HtmlToConsole.xml</p>
+
+ <p>will create the file <em>test.html</em> in the current
+ folder. The contents of <em>test.html</em> should be similar to:
</p>
- <img src="images/htmlLayout1.jpg" alt="HTML Layout Sample Image"/>
+ <img src="images/chapters/layouts/htmlLayout1.jpg" alt="HTML Layout Sample Image"/>
<h3>Stack traces</h3>
@@ -1737,27 +1786,30 @@ public class TrivialMain {
</p>
<pre class="prettyprint source"><configuration>
- <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
- <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
- <ActiveFileName>lastLogEntries.html</ActiveFileName>
- <FileNamePattern>logEntries.%d{yyyy-MM-dd}.log</FileNamePattern>
- </rollingPolicy>
-
- <layout class="ch.qos.logback.classic.html.HTMLLayout">
- <cssBuilder class="ch.qos.logback.core.html.UrlCssBuilder">
- <url>address_of_a_custom_stylesheet.css</url>
- </cssBuilder>
- <Pattern>%relative%thread%mdc%level%logger%msg</Pattern>
- <b><Title>Logging Events</Title></b>
- </layout>
- </appender>
+ <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>lastLogEntries.html</file>
+ <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ <fileNamePattern>logEntries.%d{yyyy-MM-dd}.log</fileNamePattern>
+ </rollingPolicy>
- <root level="debug">
- <appender-ref ref="FILE" />
- </root>
+ <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
+ <layout class="ch.qos.logback.classic.html.HTMLLayout">
+ <cssBuilder class="ch.qos.logback.core.html.UrlCssBuilder">
+ <url>address_of_a_custom_stylesheet.css</url>
+ </cssBuilder>
+ <pattern>%relative%thread%mdc%level%logger%msg</pattern>
+ <b><title>Logging Events</title></b>
+ </layout>
+ </encoder>
+ </appender>
+
+ <root level="DEBUG">
+ <appender-ref ref="FILE" />
+ </root>
</configuration></pre>
- <h3><a name="log4jXMLLayout" href="#log4jXMLLayout">Log4j XMLLayout</a></h3>
+ <h2><a name="log4jXMLLayout" href="#log4jXMLLayout">Log4j
+ XMLLayout</a></h2>
<p><a
@@ -1775,11 +1827,11 @@ public class TrivialMain {
<p>As the original XMLLayout in log4j version 1.2.15, XMLLayout in
logback-classic admits two boolean properties, <span
- class="option">LocationInfo</span> and <span
- class="option">Properties</span>. Setting <span
- class="option">LocationInfo</span> to true enables the inclusion
+ class="option">locationInfo</span> and <span
+ class="option">properties</span>. Setting <span
+ class="option">locationInfo</span> to true enables the inclusion
of location info (caller data) in the each event. Setting <span
- class="option">Properties</span> to true enables the inclusion of
+ class="option">properties</span> to true enables the inclusion of
MDC information. Both options are set to false by default.
</p>
@@ -1787,13 +1839,15 @@ public class TrivialMain {
<pre class="prettyprint source"><configuration>
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
- <File>test.xml</File>
- <layout class="ch.qos.logback.classic.log4j.XMLLayout">
- <LocationInfo>true</LocationInfo>
- </layout>
+ <file>test.xml</file>
+ <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
+ <layout class="ch.qos.logback.classic.log4j.XMLLayout">
+ <locationInfo>true</locationInfo>
+ </layout>
+ </encoder>
</appender>
- <root level="debug">
+ <root level="DEBUG">
<appender-ref ref="FILE" />
</root>
</configuration> </pre>
@@ -2110,7 +2164,7 @@ public class TrivialMain {
<p>Here is a sample output produced by <code>HTMLLayout</code> in
logback-access:</p>
- <img src="images/htmlLayoutAccess.gif" alt="Access HTML Layout Sample Image"/>
+ <img src="images/chapters/layouts/htmlLayoutAccess.gif" alt="Access HTML Layout Sample Image"/>
<p>What can be better than a real world example? Our own log4j
properties for logback <a
diff --git a/logback-site/src/site/resources/manual/images/htmlLayout0.gif b/logback-site/src/site/resources/manual/images/chapters/layouts/htmlLayout0.gif
similarity index 100%
rename from logback-site/src/site/resources/manual/images/htmlLayout0.gif
rename to logback-site/src/site/resources/manual/images/chapters/layouts/htmlLayout0.gif
diff --git a/logback-site/src/site/resources/manual/images/chapters/layouts/htmlLayout1.png b/logback-site/src/site/resources/manual/images/chapters/layouts/htmlLayout1.png
new file mode 100644
index 0000000..8969743
Binary files /dev/null and b/logback-site/src/site/resources/manual/images/chapters/layouts/htmlLayout1.png differ
diff --git a/logback-site/src/site/resources/manual/images/htmlLayoutAccess.gif b/logback-site/src/site/resources/manual/images/chapters/layouts/htmlLayoutAccess.gif
similarity index 100%
rename from logback-site/src/site/resources/manual/images/htmlLayoutAccess.gif
rename to logback-site/src/site/resources/manual/images/chapters/layouts/htmlLayoutAccess.gif
diff --git a/logback-site/src/site/resources/manual/images/htmlLayout1.jpg b/logback-site/src/site/resources/manual/images/htmlLayout1.jpg
deleted file mode 100644
index 4bec059..0000000
Binary files a/logback-site/src/site/resources/manual/images/htmlLayout1.jpg and /dev/null differ
-----------------------------------------------------------------------
Summary of changes:
.../classic/turbo/ReconfigureOnChangeTest.java | 6 +-
.../core/encoder/LayoutWrappingEncoder.java | 2 +-
.../appenders/conf/logback-HtmlToConsole.xml | 14 +-
.../java/chapters/filters/levelFilterConfig.xml | 4 +-
.../java/chapters/filters/sampleFilterConfig.xml | 9 +-
.../chapters/filters/thresholdFilterConfig.xml | 4 +-
.../layouts/ExceptionEvaluatorExample.java | 8 +-
.../main/java/chapters/layouts/SampleLogging.java | 14 +-
...allerEvaluatorExample.java => TrivialMain.java} | 38 ++--
.../chapters/layouts/exceptionEvaluatorConfig.xml | 10 +-
.../java/chapters/layouts/htmlLayoutConfig1.xml | 14 +
.../chapters/layouts/mySampleConverterConfig.xml | 14 +-
logback-site/src/site/pages/manual/filters.html | 77 +++---
logback-site/src/site/pages/manual/layouts.html | 258 ++++++++++++--------
.../images/{ => chapters/layouts}/htmlLayout0.gif | Bin 9841 -> 9841 bytes
.../manual/images/chapters/layouts/htmlLayout1.png | Bin 0 -> 21825 bytes
.../{ => chapters/layouts}/htmlLayoutAccess.gif | Bin 148822 -> 148822 bytes
.../site/resources/manual/images/htmlLayout1.jpg | Bin 37074 -> 0 bytes
18 files changed, 271 insertions(+), 201 deletions(-)
copy logback-examples/src/main/java/chapters/layouts/{CallerEvaluatorExample.java => TrivialMain.java} (57%)
create mode 100644 logback-examples/src/main/java/chapters/layouts/htmlLayoutConfig1.xml
rename logback-site/src/site/resources/manual/images/{ => chapters/layouts}/htmlLayout0.gif (100%)
create mode 100644 logback-site/src/site/resources/manual/images/chapters/layouts/htmlLayout1.png
rename logback-site/src/site/resources/manual/images/{ => chapters/layouts}/htmlLayoutAccess.gif (100%)
delete mode 100644 logback-site/src/site/resources/manual/images/htmlLayout1.jpg
hooks/post-receive
--
Logback: the generic, reliable, fast and flexible logging framework.
1
0

[JIRA] Created: (CONSPLUG-24) improve config to allow filters on the logger, not just on the console
by Joe Kearney (JIRA) 11 Mar '10
by Joe Kearney (JIRA) 11 Mar '10
11 Mar '10
improve config to allow filters on the logger, not just on the console
----------------------------------------------------------------------
Key: CONSPLUG-24
URL: http://jira.qos.ch/browse/CONSPLUG-24
Project: Console Plugin
Issue Type: New Feature
Components: other
Reporter: Joe Kearney
Assignee: Logback dev list
Currently every log statement is sent to the console plugin. This is expensive with lots of logging going on, especially if there's lots of debug logging that's expected to be filtered much earlier when you get to production. It would be helpful to be able to provide filters in the logger config as well as in the plugin.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
1
0