Clean up the logging system later in context close processing
Previously, the logging system was cleaned up in response to the root context's ContextClosedEvent being received. This event is published early in a context's close processing. As a result, the logging system is in cleaned up state while, for example, disposable beans are being destroyed. This commit reworks the logic that triggers logging system clean up to use a disposable bean instead. Disposable beans are called in reverse-registration order. The logging clean up bean is registered as early as possible so that it should be the last disposable bean to be called. Closes gh-11676
This commit is contained in:
@@ -30,7 +30,7 @@ import org.springframework.boot.context.event.ApplicationFailedEvent;
|
||||
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||
import org.springframework.boot.context.event.ApplicationStartingEvent;
|
||||
import org.springframework.boot.context.event.SpringApplicationEvent;
|
||||
import org.springframework.boot.context.logging.LoggingApplicationListener;
|
||||
import org.springframework.boot.context.logging.LoggingSystemLifecycle;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.format.support.DefaultFormattingConversionService;
|
||||
@@ -45,7 +45,7 @@ import org.springframework.http.converter.support.AllEncompassingFormHttpMessage
|
||||
* @author Andy Wilkinson
|
||||
* @since 1.3.0
|
||||
*/
|
||||
@Order(LoggingApplicationListener.DEFAULT_ORDER + 1)
|
||||
@Order(LoggingSystemLifecycle.DEFAULT_ORDER + 1)
|
||||
public class BackgroundPreinitializer
|
||||
implements ApplicationListener<SpringApplicationEvent> {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user