logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mauro Molinari (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LOG4J2-684) ConsoleAppender does not print suppressed exceptions
Date Mon, 29 Jun 2015 07:28:04 GMT

    [ https://issues.apache.org/jira/browse/LOG4J2-684?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14605232#comment-14605232
] 

Mauro Molinari commented on LOG4J2-684:
---------------------------------------

Hi Gary,
I just tried the 2.4-SNAPSHOT version. To test it I've changed the {{build.gradle}} file in
this way:

{noformat}
apply plugin: 'application'

sourceCompatibility = 1.7

repositories {
    mavenCentral()
    maven { url 'http://repository.apache.org/snapshots/' }
}

dependencies {
	compile 'org.slf4j:slf4j-api:1.7.7'
	runtime 'org.apache.logging.log4j:log4j-slf4j-impl:2.4-SNAPSHOT'
	runtime 'org.apache.logging.log4j:log4j-web:2.4-SNAPSHOT'
}

mainClassName = 'test.Test' 

task wrapper(type: Wrapper) {
	gradleVersion = '2.4'
}
{noformat}

The output is this:

{noformat}
[ERROR] 2015/06/29 09:17:22 - main - test.Test - error
java.lang.RuntimeException: outer
	at test.Test.foo(Test.java:24) ~[bin/:?]
	at test.Test.main(Test.java:14) [bin/:?]
printStackTrace follows
java.lang.RuntimeException: outer
	at test.Test.foo(Test.java:24)
	at test.Test.main(Test.java:14)
	Suppressed: java.lang.RuntimeException: suppressed
		at test.Test.foo(Test.java:25)
		... 1 more
{noformat}

Unless I'm doing something wrong regarding the appender configuration, I still can't see the
suppressed exception when logging.
Can you reproduce?

Regarding your trial, I see that SLF4j is saying there are both logback and log4j binding
on the classpath, and from the output you pasted (" Actual binding is of type \[ch.qos.logback.classic.util.ContextSelectorStaticBinder\]")
I would say it's using Logback rather than Log4j2... This would explain why you see a correct
output.


> ConsoleAppender does not print suppressed exceptions
> ----------------------------------------------------
>
>                 Key: LOG4J2-684
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-684
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0-rc1
>         Environment: ------------------------------------------------------------
> Gradle 1.12
> ------------------------------------------------------------
> Build time:   2014-04-29 09:24:31 UTC
> Build number: none
> Revision:     a831fa866d46cbee94e61a09af15f9dd95987421
> Groovy:       1.8.6
> Ant:          Apache Ant(TM) version 1.9.3 compiled on December 23 2013
> Ivy:          2.2.0
> JVM:          1.8.0_05 (Oracle Corporation 25.5-b02)
> OS:           Mac OS X 10.9.3 x86_64
>            Reporter: Joern Huxhorn
>         Attachments: LOG4J2-684.zip
>
>
> (Actual version was 2.0-rc2 but that wasn't available in the list.)
> Currently, any potentially available suppressed exceptions are ignored by ConsoleAppender.
> Instead, it should print those exceptions with the prefix "Suppressed: ". Be aware that
suppressed exceptions are indented with a \t, recursively, in contrast to the way "Caused
by: " is handled.
> See Throwable.printStackTrace of Java 7 or higher for the implementation.
> Feel free to use the code over at https://github.com/huxi/lilith/blob/master/lilith-data/logging/src/main/java/de/huxhorn/lilith/data/logging/ThrowableInfo.java
if it helps.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message