Skip to content

Commit

Permalink
Prefix stack traces with a newline in Status Logger (#3149)
Browse files Browse the repository at this point in the history
  • Loading branch information
vy authored Oct 31, 2024
1 parent eefca59 commit 328dd30
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public String getFormattedStatus() {
effectiveThrowable = throwable;
}
if (effectiveThrowable != null) {
sb.append(SPACE);
sb.append(System.lineSeparator());
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
effectiveThrowable.printStackTrace(new PrintStream(baos));
/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ void testExceptionsAreLoggedToStatusLogger() {
assertThat(
formattedMessage,
containsString("Exception reported by action 'class org.apache."
+ "logging.log4j.core.appender.rolling.action.AbstractActionTest$TestAction' java.io.IOException: "
+ "failed" + System.lineSeparator()
+ "logging.log4j.core.appender.rolling.action.AbstractActionTest$TestAction'"
+ System.lineSeparator()
+ "java.io.IOException: failed" + System.lineSeparator()
+ "\tat org.apache.logging.log4j.core.appender.rolling.action.AbstractActionTest"
+ "$TestAction.execute(AbstractActionTest.java:"));
}
Expand Down
2 changes: 1 addition & 1 deletion src/changelog/.2.x.x/3045_change_PatternLayout_prefix.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
xsi:schemaLocation="https://logging.apache.org/xml/ns https://logging.apache.org/xml/ns/log4j-changelog-0.xsd"
type="changed">
<issue id="3045" link="https://github.com/apache/logging-log4j2/pull/3045"/>
<description format="asciidoc">Change the whitespace prefixing logic in Pattern Layout</description>
<description format="asciidoc">Switch prefixing stack traces in Pattern Layout from whitespace to newline</description>
</entry>
8 changes: 8 additions & 0 deletions src/changelog/.2.x.x/3149_change_StatusData_prefix.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://logging.apache.org/xml/ns"
xsi:schemaLocation="https://logging.apache.org/xml/ns https://logging.apache.org/xml/ns/log4j-changelog-0.xsd"
type="changed">
<issue id="3149" link="https://github.com/apache/logging-log4j2/pull/3149"/>
<description format="asciidoc">Switch prefixing stack traces in Status Logger from whitespace to newline</description>
</entry>

0 comments on commit 328dd30

Please sign in to comment.