diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/FilteringStatusListener.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/FilteringStatusListener.java index b2625044a646..247272bb8566 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/FilteringStatusListener.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/FilteringStatusListener.java @@ -27,7 +27,7 @@ * * @author Dmytro Nosan */ -final class FilteringStatusListener extends ContextAwareBase implements StatusListener, LifeCycle { +class FilteringStatusListener extends ContextAwareBase implements StatusListener, LifeCycle { private final StatusListener delegate; diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java index d143b37fb258..ebb47f9a619d 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java @@ -495,8 +495,10 @@ private void addOnErrorConsoleStatusListener(LoggerContext context) { FilteringStatusListener listener = new FilteringStatusListener(new OnErrorConsoleStatusListener(), Status.ERROR); listener.setContext(context); - context.getStatusManager().add(listener); - listener.start(); + boolean effectivelyAdded = context.getStatusManager().add(listener); + if (effectivelyAdded) { + listener.start(); + } } void setStatusPrinterStream(PrintStream stream) {