vy commented on code in PR #1137:
URL: https://github.com/apache/logging-log4j2/pull/1137#discussion_r1015911291
##########
log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/ExtendedThrowablePatternConverter.java:
##########
@@ -71,8 +72,22 @@ public void format(final LogEvent event, final StringBuilder
toAppendTo) {
if (len > 0 && !Character.isWhitespace(toAppendTo.charAt(len -
1))) {
toAppendTo.append(' ');
}
- proxy.formatExtendedStackTraceTo(toAppendTo,
options.getIgnorePackages(),
+ final String trace =
proxy.getExtendedStackTraceAsString(options.getIgnorePackages(),
Review Comment:
`formatExtendedStackTrace` strives to perform a garbage-free dump. Your
version switches the behaviour to allocate an entire `String` (and more) every
time. Next to that, I would expect this _"stacktrace trimming"_ to be a
functionality of `ThrowablePatternConverter`, which is extended by
`ExtendedThrowablePatternConverter`, rather than duplicating it here.
In conclusion, I expect stacktrace trimming
* to be provided by `ThrowablePatternConverter` and
* to be discarded and `formatExtendedStackTraceTo()` used instead, if no
trimming is requested
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]