You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Dave Brosius (JIRA)" <ji...@apache.org> on 2018/01/29 21:21:00 UTC

[jira] [Comment Edited] (LOG4J2-2235) Add ThrowableFormatOptions "COLLAPSE"

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

Dave Brosius edited comment on LOG4J2-2235 at 1/29/18 9:20 PM:
---------------------------------------------------------------

Imagine in your log4j file you entered (after the fix)

 

<PatternLayout pattern="[%p] %c:%L - %m%n %xEx{*collapse*,filters(sun.reflect.,scala.,org.springframework.)}"/>

Then a stack trace that looked like

 

com.acme.MyBean: 43

org.springframework.somecrazy.WiringCode:23

org.springframework.somecrazy.WiringCode:55

org.springframework.somecrazy.WiringCode:2873

org.springframework.somecrazy.WiringCode:356

org.springframework.somecrazy.WiringCode:123

org.springframework.somecrazy.WiringCode:432

org.springframework.somecrazy.WiringCode:12

org.springframework.somecrazy.WiringCode:654

org.springframework.somecrazy.WiringCode:524

org.springframework.somecrazy.WiringCode:124

org.springframework.somecrazy.WiringCode:123

org.springframework.somecrazy.WiringCode:5443

com.acme.MyResource:121

 

would now only output as

 

com.acme.MyBean: 43

org.springframework.somecrazy.WiringCode:23

....

com.acme.MyResource:121

 

 

 

 

 


was (Author: dbrosius):
Imagine in your log4j file you entered (after the fix)

 

<PatternLayout pattern="[%p] %c:%L - %m%n %xEx{*collapse*,filters(sun.reflect.,scala.,org.springframework.)}"/> 

Then a stack trace that looked like

 

com.acme.MyBean: 43

org.springframework.somecrazy.WiringCode:23

org.springframework.somecrazy.WiringCode:55

org.springframework.somecrazy.WiringCode:2873

org.springframework.somecrazy.WiringCode:356

org.springframework.somecrazy.WiringCode:123

org.springframework.somecrazy.WiringCode:432

org.springframework.somecrazy.WiringCode:12

org.springframework.somecrazy.WiringCode:654

org.springframework.somecrazy.WiringCode:524

org.springframework.somecrazy.WiringCode:124

org.springframework.somecrazy.WiringCode:123

org.springframework.somecrazy.WiringCode:5443

com.acme.MyResource:121

 

would now only output as

 

com.acme.MyBean: 43

org.springframework.somecrazy.WiringCode:23

 

....

com.acme.MyResource:121

 

 

 

 

 

> Add ThrowableFormatOptions "COLLAPSE"
> -------------------------------------
>
>                 Key: LOG4J2-2235
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2235
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: Layouts
>    Affects Versions: 2.10.0
>            Reporter: Dave Brosius
>            Priority: Minor
>             Fix For: 2.11.0
>
>
> Given that stack traces get out of hand when you have things like spring, hibernate, jersey etc, it would be nice to add an option like "COLLAPSE" that works similar to how you can pass in ignorePackages.
>  
> so that if you have a run of stacktraces that all come from the same package prefix, and you specified that that package name be part of a new collapsePackage set, then only the first and last stacktrace in that list would be shown. That way you can tell that spring was involved, for instance, but you wouldn't have to see 15 stacktrace elements of spring junk that you aren't interested in.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)