[logback-dev] [JIRA] (LOGBACK-1274) Logback swallows output from Exceptions overriding toString()
QOS.CH (JIRA)
noreply-jira at qos.ch
Wed Mar 8 17:06:00 CET 2017
Claus created LOGBACK-1274:
------------------------------
Summary: Logback swallows output from Exceptions overriding toString()
Key: LOGBACK-1274
URL: https://jira.qos.ch/browse/LOGBACK-1274
Project: logback
Issue Type: Bug
Components: logback-classic
Affects Versions: 1.2.1
Environment: Windows, Java 8
Reporter: Claus
Assignee: Logback dev list
Attachments: logback.xml, LoggerTest.java
When logging exceptions that overwrite toString() then logback ignores the output of it. For example:
{code:java}
class OverridingException extends Exception {
@Override
public String toString() {
return super.toString() + " important additional information";
}
}{code}
When used with logback the following code
{code:java}
@Test
public void testName() {
org.slf4j.Logger logger = LoggerFactory.getLogger(LoggerTest.class);
try {
throw new OverridingException();
} catch (Throwable t) {
logger.error("", t);
}
}{code}
produces output without the string "important additional information"
{code:java}
2017-03-08 16:44:27 [main] ERROR trial.LoggerTest -
trial.LoggerTest$OverridingException: null
at trial.LoggerTest.testName(LoggerTest.java:32){code}
while Java Util Logging outputs correctly
{code:java}
Mär 08, 2017 4:44:27 PM trial.LoggerTest testLogging
SCHWERWIEGEND:
trial.LoggerTest$OverridingException important additional information
at trial.LoggerTest.testLogging(LoggerTest.java:22){code}
Testfile and logback.xml attached.
--
This message was sent by Atlassian JIRA
(v7.3.1#73012)
More information about the logback-dev
mailing list