Skip to content

Commit 4ebbd92

Browse files
committed
doc: clarify %ex whitespace behavior across versions
This update documents the historical whitespace handling of the `%ex` pattern converter and how it has evolved in the `2.25.x` releases. Key point: since `2.25.2`, when users add `%ex` explicitly in their pattern, Log4j no longer inserts any automatic separator. It is now entirely up to the user to decide how (or whether) to separate the stack trace from the preceding output. Related to #3837
1 parent 8e80e9e commit 4ebbd92

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/site/antora/modules/ROOT/pages/manual/pattern-layout.adoc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,13 @@ In this mode, the exception stack trace will be rendered according to the config
603603
604604
[IMPORTANT]
605605
====
606-
All rendered exception stack traces are ensured to be prefixed with a new line obtained using `System.lineSeparator()`.
606+
Earlier versions of Log4j Core always inserted a space between the *output* of the previous conversion specifier and the stack trace.
607+
608+
Starting with version `2.25.0`, this was changed to a line separator instead of a space.
609+
610+
Since version `2.25.2`, automatic separation occurs *only* for converters implicitly added via the <<plugin-attr-alwaysWriteExceptions>> option.
611+
612+
When you add a throwable converter explicitly in your pattern, Log4j Core no longer inserts any separator on its own: you have full control over whether and how to separate the stack trace from the preceding message.
607613
====
608614
609615
link:../javadoc/log4j-core/org/apache/logging/log4j/core/pattern/ThrowablePatternConverter.html[`ThrowablePatternConverter`] specifier grammar **for rendering stack traces**:

0 commit comments

Comments
 (0)