Skip to content

Commit 328dd30

Browse files
authored
Prefix stack traces with a newline in Status Logger (#3149)
1 parent eefca59 commit 328dd30

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

log4j-api/src/main/java/org/apache/logging/log4j/status/StatusData.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public String getFormattedStatus() {
182182
effectiveThrowable = throwable;
183183
}
184184
if (effectiveThrowable != null) {
185-
sb.append(SPACE);
185+
sb.append(System.lineSeparator());
186186
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
187187
effectiveThrowable.printStackTrace(new PrintStream(baos));
188188
/*

log4j-core-test/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/AbstractActionTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ void testExceptionsAreLoggedToStatusLogger() {
4747
assertThat(
4848
formattedMessage,
4949
containsString("Exception reported by action 'class org.apache."
50-
+ "logging.log4j.core.appender.rolling.action.AbstractActionTest$TestAction' java.io.IOException: "
51-
+ "failed" + System.lineSeparator()
50+
+ "logging.log4j.core.appender.rolling.action.AbstractActionTest$TestAction'"
51+
+ System.lineSeparator()
52+
+ "java.io.IOException: failed" + System.lineSeparator()
5253
+ "\tat org.apache.logging.log4j.core.appender.rolling.action.AbstractActionTest"
5354
+ "$TestAction.execute(AbstractActionTest.java:"));
5455
}

src/changelog/.2.x.x/3045_change_PatternLayout_prefix.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
xsi:schemaLocation="https://logging.apache.org/xml/ns https://logging.apache.org/xml/ns/log4j-changelog-0.xsd"
55
type="changed">
66
<issue id="3045" link="https://github.com/apache/logging-log4j2/pull/3045"/>
7-
<description format="asciidoc">Change the whitespace prefixing logic in Pattern Layout</description>
7+
<description format="asciidoc">Switch prefixing stack traces in Pattern Layout from whitespace to newline</description>
88
</entry>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<entry xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xmlns="https://logging.apache.org/xml/ns"
4+
xsi:schemaLocation="https://logging.apache.org/xml/ns https://logging.apache.org/xml/ns/log4j-changelog-0.xsd"
5+
type="changed">
6+
<issue id="3149" link="https://github.com/apache/logging-log4j2/pull/3149"/>
7+
<description format="asciidoc">Switch prefixing stack traces in Status Logger from whitespace to newline</description>
8+
</entry>

0 commit comments

Comments
 (0)