Skip to content

Prefix stack traces with a newline in Status Logger #3149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>