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

Volkan Yazici commented on LOG4J2-3156:
---------------------------------------

[~Alisihab], I neither know the answer to your question, nor have time to 
investigate it right now. Yet, I can recommend you taking a look at 
{{ThrowablePatternConverter}} and {{ExtendedThrowablePatternConverter}} classes 
where this logic is implemented. This might give you a clue for either a 
solution or a more detailed bug report. ;)

> 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
>            Priority: Minor
>         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> 
> <!-- condensed stacktrace with no library information -->
> <Pattern>%d\{yyyy-MM-dd HH:mm:ss,SSS} %5p [%t] %TC %c\{2} - 
> %m%xEx%n</Pattern> <!-- with library information but no condensed stacktrace 
> -->
> 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)

Reply via email to