You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Ali Akcan (Jira)" <ji...@apache.org> on 2021/09/01 10:28:00 UTC
[jira] [Created] (LOG4J2-3156) Stacktraces with xEx conversion are
expanded resulting in duplicate/redundant line in the trace
Ali Akcan created LOG4J2-3156:
---------------------------------
Summary: Stacktraces with xEx conversion are expanded resulting in duplicate/redundant line in the trace
Key: LOG4J2-3156
URL: https://issues.apache.org/jira/browse/LOG4J2-3156
Project: Log4j 2
Issue Type: Bug
Components: Layouts
Affects Versions: 2.14.1
Reporter: Ali Akcan
Attachments: ex.txt, xEx.txt
I have an application that uses the log4j2(2.14.1) library for logging. In the application I use PatternLayout. The conversion patterns for the stackTraceElement seems a bit confusing to me. If I use the 'ex' conversion pattern for the stack traces I get the .... xx more view for nested exceptions. That is totally fine since I do not want to see duplicate things in the trace. In addition to this I would like to see the jar file name in each line of the stacktrace.
By looking at the documentation of PatternLayout( [https://logging.apache.org/log4j/2.x/manual/layouts.html#PatternLayout] ) I see that I can use xEx conversion. In the documentation it says 'The same as the %throwable conversion word but also includes class packaging information.' for the xEx conversion. However, when I use the xEx conversion in my pattern I see the '... xx more' collapsed views are expanded(e.g. ... 137 more becomes ... 6 more and prints the 131 lines) and display the same lines as the parent/child exception. This results in lots of duplicated and redundant lines in the stacktrace.
In the attachments you may see the differences of 'ex' and 'xEx' conversions for the same trace.
Patterns I used:
<Pattern>%d\{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%t] %TC %c\{2} - %m%ex%n</Pattern>
<Pattern>%d\{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%t] %TC %c\{2} - %m%xEx%n</Pattern>
Is there a different way to keep the stacktrace showing ... xx more lines view in combination with the jar filename in each line in the trace?
--
This message was sent by Atlassian Jira
(v8.3.4#803005)