Skip to content

Commit e3610ea

Browse files
committed
Fix "Used nested format for ECS structure logging" test on Windows
See gh-45063
1 parent 34a43c1 commit e3610ea

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/log4j2/ElasticCommonSchemaStructuredLogFormatterTests.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,13 @@ void shouldFormatException() {
9494
expectedError.put("message", "Boom");
9595
assertThat(error).containsAllEntriesOf(expectedError);
9696
String stackTrace = (String) error.get("stack_trace");
97-
assertThat(stackTrace)
98-
.startsWith(String.format("java.lang.RuntimeException: Boom%n\tat org.springframework.boot.logging.log4j2."
99-
+ "ElasticCommonSchemaStructuredLogFormatterTests.shouldFormatException"));
100-
assertThat(json).contains(String
101-
.format("java.lang.RuntimeException: Boom%n\\tat org.springframework.boot.logging.log4j2."
102-
+ "ElasticCommonSchemaStructuredLogFormatterTests.shouldFormatException")
103-
.replace("\n", "\\n")
104-
.replace("\r", "\\r"));
97+
assertThat(stackTrace).startsWith(
98+
"""
99+
java.lang.RuntimeException: Boom
100+
\tat org.springframework.boot.logging.log4j2.ElasticCommonSchemaStructuredLogFormatterTests.shouldFormatException""");
101+
assertThat(json).contains(
102+
"""
103+
java.lang.RuntimeException: Boom\\n\\tat org.springframework.boot.logging.log4j2.ElasticCommonSchemaStructuredLogFormatterTests.shouldFormatException""");
105104
}
106105

107106
@Test

0 commit comments

Comments
 (0)