Spring boot 2.4.2
Logback is reset twice https://github.com/spring-projects/spring-boot/blob/d283e5957c1a66c96ef3961de88a112abaeff5cd/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java#L195-L197 because stop also calls reset: https://github.com/qos-ch/logback/blob/61ffd3aba042bbb22f588599ff5574d3b9667d22/logback-classic/src/main/java/ch/qos/logback/classic/LoggerContext.java#L349-L350
This causes issues when using a LoggerContextListener
that adds custom appenders, and is removed after reset (isResetResistant
false).
Due to duplicate reset, the appenders are removed at second reset and the listener is not called the second time, so the result is no custom appenders.
Comment From: cdalexndr
Actually, stop()
also removes all listeners, so my use case is not valid.
Comment From: scottfrederick
Indeed, stop()
removes all listeners, while reset()
only removes non-reset-resistant listeners.