You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Gary Gregory (JIRA)" <ji...@apache.org> on 2013/08/23 06:19:55 UTC

[jira] [Commented] (LOG4J2-319) Double stack trace logging when using %throwable in a %style

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

Gary Gregory commented on LOG4J2-319:
-------------------------------------

The real bug is that when using %style, the pattern parser in the config does not know that exceptions may be used in the style pattern. Since it does not know, the parser adds exception logging (based on the alwaysWriteExceptions). The attached patch fixes that.
                
> Double stack trace logging when using %throwable in a %style
> ------------------------------------------------------------
>
>                 Key: LOG4J2-319
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-319
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Layouts
>    Affects Versions: 2.0-beta8
>         Environment: Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 08:51:28-0500)
> Maven home: C:\Java\apache-maven-3.0.5\bin\..
> Java version: 1.7.0_25, vendor: Oracle Corporation
> Java home: C:\Program Files\Java\jdk1.7.0_25\jre
> Default locale: en_US, platform encoding: Cp1252
> OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
>            Reporter: Gary Gregory
>
> I'm seeing something odd in trunk:
> When I run org.apache.logging.log4j.core.appender.ConsoleAppenderAnsiStyleLayoutMain
> I see double stack traces:
> [30m2013-07-07 02:27:09,904 [m [34m[main] [m [33mFATAL: [m [32mFatal message.
> [m [30m2013-07-07 02:27:09,906 [m [34m[main] [m [33mERROR: [m [32mError message.
> [m [30m2013-07-07 02:27:09,907 [m [34m[main] [m [33mWARN : [m [32mWarning message.
> [m [30m2013-07-07 02:27:09,907 [m [34m[main] [m [33mINFO : [m [32mInformation message.
> [m [30m2013-07-07 02:27:09,907 [m [34m[main] [m [33mDEBUG: [m [32mDebug message.
> [m [30m2013-07-07 02:27:09,907 [m [34m[main] [m [33mTRACE: [m [32mTrace message.
> [m [30m2013-07-07 02:27:09,907 [m [34m[main] [m [33mERROR: [m [32mError message.
> java.io.IOException: test
>     at org.apache.logging.log4j.core.appender.ConsoleAppenderAnsiStyleLayoutMain.main(ConsoleAppenderAnsiStyleLayoutMain.java:44)
> [m java.io.IOException: test
>     at org.apache.logging.log4j.core.appender.ConsoleAppenderAnsiStyleLayoutMain.main(ConsoleAppenderAnsiStyleLayoutMain.java:44) [test-classes/:?]
> Note that the last one includes jar provenance.
> The patter in /log4j-core/src/test/resources/log4j2-console-style-ansi.xml is:
> %style{%d{ISO8601}}{black} %style{[%t]}{blue} %style{%-5level:}{yellow} %style{%msg%n%throwable}{green}
> When I switch the test to use
> /log4j-core/src/test/resources/log4j2-console.xml, the output contains a single track trace without jar provenance. The patter there is:
> %d{ISO8601} [%t] %-5level: %msg%n%throwable
> Looks like a bug in pattern/layout parsing?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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