Example usage for org.springframework.boot.logging LoggingSystem getShutdownHandler

List of usage examples for org.springframework.boot.logging LoggingSystem getShutdownHandler

Introduction

In this page you can find the example usage for org.springframework.boot.logging LoggingSystem getShutdownHandler.

Prototype

public Runnable getShutdownHandler() 

Source Link

Document

Returns a Runnable that can handle shutdown of this logging system when the JVM exits.

Usage

From source file:org.springframework.boot.context.logging.LoggingApplicationListener.java

private void registerShutdownHookIfNecessary(Environment environment, LoggingSystem loggingSystem) {
    boolean registerShutdownHook = environment.getProperty(REGISTER_SHUTDOWN_HOOK_PROPERTY, Boolean.class,
            false);/*from   ww w  . ja v  a2s .c  o m*/
    if (registerShutdownHook) {
        Runnable shutdownHandler = loggingSystem.getShutdownHandler();
        if (shutdownHandler != null && shutdownHookRegistered.compareAndSet(false, true)) {
            registerShutdownHook(new Thread(shutdownHandler));
        }
    }
}

From source file:org.springframework.boot.logging.LoggingApplicationListener.java

private void registerShutdownHookIfNecessary(Environment environment, LoggingSystem loggingSystem) {
    boolean registerShutdownHook = new RelaxedPropertyResolver(environment)
            .getProperty(REGISTER_SHUTDOWN_HOOK_PROPERTY, Boolean.class, false);
    if (registerShutdownHook) {
        Runnable shutdownHandler = loggingSystem.getShutdownHandler();
        if (shutdownHandler != null && shutdownHookRegistered.compareAndSet(false, true)) {
            registerShutdownHook(new Thread(shutdownHandler));
        }/*  w  w  w.  ja  va  2s.co m*/
    }
}