vy commented on PR #1137:
URL: https://github.com/apache/logging-log4j2/pull/1137#issuecomment-1538034225
@theit, sorry for the late response. I was just able to pick this up.
Both `ThrowablePatternConverter` (`%ex`) and `RootThrowablePatternConverter`
(`%rEx`), which delegates back to `ThrowablePatternConverter` (`%xEx`), simply
do a `String#split("\\n")` and retain the first `N` lines. On the other hand,
your `ThrowableProxyRenderer` changes count and, if necessary, limit the number
of lines along the rendering process. This diligent work (which I am thankful
that you took time to implement) is pretty sophisticated (and error-prone?)
compared to its `%ex` counterpart. I would be in favor of a simpler approach:
simply **truncate the lines in `StringBuilder` just before the exit in
package-private methods of `ThrowableProxyRenderer`**. If you can implement
this, I would be more than happy to accept your PR.
Ideally, we should wrap the `StringBuilder` with a
`LineLimitedStringBuilder` wrapper, and pass that to `Throwable` rendering
routines. But that will probably necessitate changes in dozens of files. Hence,
let's try to keep it simple for now.
--
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]