[
https://issues.apache.org/jira/browse/LOG4J2-1838?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Zilong Song updated LOG4J2-1838:
--------------------------------
Description:
Add support for appending common suffix to each line of throwable stack trace.
The suffix can be configured by patterns just like patterns used elsewhere.
For example, pattern {{%xEx{suffix(- %mdc{key})}}} will
append a string generated by pattern {{- }} and {{%mdc{key}}}.
But patterns that handles throwable will be automatically ignored, because they
will make the rendered result confusing. So pattern {{%xEx{suffix(-
%rEx%mdc{key})}}} has the same effect with {{%xEx{suffix(-
%mdc{key})}}}, as if the nested {{%rEx}} pattern has never
appeared.
With the common suffix (for example {{suffix(- %mdc{key})}}, and MDC
value to {{key}} is {{test mdc suffix}}), the stack trace is as following:
{code:title=stack trace|borderStyle=solid}
java.lang.IllegalArgumentException: IllegalArgument - test mdc suffix
at
org.apache.logging.log4j.core.pattern.ExtendedThrowablePatternConverterTest.testSuffixFromNormalPattern(ExtendedThrowablePatternConverterTest.java:48)
[test-classes/:?] - test mdc suffix
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
~[?:1.8.0_91] - test mdc suffix
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
~[?:1.8.0_91] - test mdc suffix
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_91] -
test mdc suffix
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
[idea_rt.jar:?] - test mdc suffix
Caused by: java.lang.NullPointerException: null pointer - test mdc suffix
at
org.apache.logging.log4j.core.pattern.ExtendedThrowablePatternConverterTest.testSuffixFromNormalPattern(ExtendedThrowablePatternConverterTest.java:47)
~[test-classes/:?] - test mdc suffix
... 27 more - test mdc suffix
}}
{code}
was:
Add support for appending common suffix to each line of throwable stack trace.
The suffix can be configured by patterns just like patterns used elsewhere.
For example, pattern {{%xEx{suffix(- %mdc{key})}}} will
append a string generated by pattern {{- }} and {{%mdc{key}}}.
But throwable patterns will be automatically ignored, because they will make
the rendered result confusing. So pattern {{%xEx{suffix(-
%rEx%mdc{key})}}} has the same effect with {{%xEx{suffix(-
%mdc{key})}}}, as if the nested {{%rEx}} pattern has never
appeared.
With the common suffix (for example {{suffix(- %mdc{key})}}, and MDC
value to {{key}} is {{test mdc suffix}}), the stack trace is as following:
{code:title=stack trace|borderStyle=solid}
java.lang.IllegalArgumentException: IllegalArgument - test mdc suffix
at
org.apache.logging.log4j.core.pattern.ExtendedThrowablePatternConverterTest.testSuffixFromNormalPattern(ExtendedThrowablePatternConverterTest.java:48)
[test-classes/:?] - test mdc suffix
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
~[?:1.8.0_91] - test mdc suffix
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
~[?:1.8.0_91] - test mdc suffix
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_91] -
test mdc suffix
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
[idea_rt.jar:?] - test mdc suffix
Caused by: java.lang.NullPointerException: null pointer - test mdc suffix
at
org.apache.logging.log4j.core.pattern.ExtendedThrowablePatternConverterTest.testSuffixFromNormalPattern(ExtendedThrowablePatternConverterTest.java:47)
~[test-classes/:?] - test mdc suffix
... 27 more - test mdc suffix
}}
{code}
> Add support for appending common suffix to each line of throwable stack trace
> -----------------------------------------------------------------------------
>
> Key: LOG4J2-1838
> URL: https://issues.apache.org/jira/browse/LOG4J2-1838
> Project: Log4j 2
> Issue Type: New Feature
> Components: Pattern Converters
> Affects Versions: 2.8.1
> Reporter: Zilong Song
> Labels: features
> Fix For: 2.8.2
>
>
> Add support for appending common suffix to each line of throwable stack
> trace. The suffix can be configured by patterns just like patterns used
> elsewhere.
> For example, pattern {{%xEx{suffix(- %mdc{key})}}} will
> append a string generated by pattern {{- }} and {{%mdc{key}}}.
> But patterns that handles throwable will be automatically ignored, because
> they will make the rendered result confusing. So pattern {{%xEx{suffix(-
> %rEx%mdc{key})}}} has the same effect with
> {{%xEx{suffix(- %mdc{key})}}}, as if the nested {{%rEx}}
> pattern has never appeared.
> With the common suffix (for example {{suffix(- %mdc{key})}}, and
> MDC value to {{key}} is {{test mdc suffix}}), the stack trace is as
> following:
> {code:title=stack trace|borderStyle=solid}
> java.lang.IllegalArgumentException: IllegalArgument - test mdc suffix
> at
> org.apache.logging.log4j.core.pattern.ExtendedThrowablePatternConverterTest.testSuffixFromNormalPattern(ExtendedThrowablePatternConverterTest.java:48)
> [test-classes/:?] - test mdc suffix
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> ~[?:1.8.0_91] - test mdc suffix
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> ~[?:1.8.0_91] - test mdc suffix
> at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_91] -
> test mdc suffix
> at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
> [idea_rt.jar:?] - test mdc suffix
> Caused by: java.lang.NullPointerException: null pointer - test mdc suffix
> at
> org.apache.logging.log4j.core.pattern.ExtendedThrowablePatternConverterTest.testSuffixFromNormalPattern(ExtendedThrowablePatternConverterTest.java:47)
> ~[test-classes/:?] - test mdc suffix
> ... 27 more - test mdc suffix
> }}
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]