-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Description
Affected:
Spring MVC: 5.2.2 (and older most likely)
Logback Version: 1.2.3
When using SLF4J with logback to log in a @PreDestroy
method of a @Service
class, the messages are lost because apparently logback shuts itself down before the user's @PreDestroy
methods complete. Its easy to not notice the missing logs for a while.
The current workaround is to disable the servlet lifecycle feature of logback. Ideally either Spring or Logback would figure out when to shut Logback down without users having to workaround this (btw, i don't know if the current workaround has any negative effects like preventing proper Logback shutdown).
This is basically the same issue as:
https://stackoverflow.com/questions/47184045/spring-predestroy-no-logging-because-logback-stops-too-soon
and similar to (but for Spring instead of Spring Boot and logback instead of Log4j2):
spring-projects/spring-boot#11360