Skip to content

Commit 33849f8

Browse files
committed
Polish "Logback StructuredLogFormatter exceptions are not visible to the user"
See gh-43575
1 parent c256f41 commit 33849f8

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/FilteringStatusListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
*
2828
* @author Dmytro Nosan
2929
*/
30-
final class FilteringStatusListener extends ContextAwareBase implements StatusListener, LifeCycle {
30+
class FilteringStatusListener extends ContextAwareBase implements StatusListener, LifeCycle {
3131

3232
private final StatusListener delegate;
3333

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,8 +495,10 @@ private void addOnErrorConsoleStatusListener(LoggerContext context) {
495495
FilteringStatusListener listener = new FilteringStatusListener(new OnErrorConsoleStatusListener(),
496496
Status.ERROR);
497497
listener.setContext(context);
498-
context.getStatusManager().add(listener);
499-
listener.start();
498+
boolean effectivelyAdded = context.getStatusManager().add(listener);
499+
if (effectivelyAdded) {
500+
listener.start();
501+
}
500502
}
501503

502504
void setStatusPrinterStream(PrintStream stream) {

0 commit comments

Comments
 (0)