Skip to content

Conversation

ppkarwasz
Copy link
Contributor

PatternParser was not detecting when a throwable was already rendered inside a nested converter (e.g. %style{%ex}{red}). Because handlesThrowable was missing for those wrappers, the parser assumed no throwable was present and incorrectly auto-appended another %ex, causing the exception to be logged twice.

This change implements handlesThrowable for the relevant nested converters so that alwaysWriteExceptions correctly recognizes them and no duplicate stack traces are produced.

`PatternParser` was not detecting when a throwable was already rendered inside a *nested* converter (e.g. `%style{%ex}{red}`).
Because `handlesThrowable` was missing for those wrappers, the parser assumed no throwable was present and incorrectly auto-appended another `%ex`, causing the exception to be logged twice.

This change implements `handlesThrowable` for the relevant nested converters so that `alwaysWriteExceptions` correctly recognizes them and no duplicate stack traces are produced.
@vy vy merged commit 59d2be9 into 2.x Sep 18, 2025
11 checks passed
@vy vy deleted the fix/2.x/handles-throwable branch September 18, 2025 17:11
@github-project-automation github-project-automation bot moved this from To triage to Done in Log4j bug tracker Sep 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants