>From the "ex|exception|throwable" section of the log4j2 2.x manual
<https://logging.apache.org/log4j/2.x/manual/layouts.html#PatternLayout> ,
it claims:
"Use {filters(packages)} where packages is a list of package names to
suppress matching stack frames from stack traces."

However, this feature doesn't seem to be implemented for %ex, only %xEx and
%rEx. I was able to easily reproduce this.

Looking at the %xEx and %rEx implementing classes, they both reference
ThrowableFormatOptions.getIgnorePackages(), as expected:
ExtendedThrowablePatternConverter.java
<https://github.com/apache/logging-log4j2/blob/release-2.x/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/ExtendedThrowablePatternConverter.java#L74>
RootThrowablePatternConverter.java
<https://github.com/apache/logging-log4j2/blob/release-2.x/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/RootThrowablePatternConverter.java#L71>

but the %ex class has no references to the ignorePackages option:
ThrowablePatternConverter.java
<https://github.com/apache/logging-log4j2/blob/release-2.x/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/ThrowablePatternConverter.java>

Are there plans to implement this feature in the %ex pattern?

Is it generally recommended to use %rEx or %xEx instead?

Thanks,
Damien

Reply via email to