@ Override public void end ( InterpretationContext ic , String name ) throws ActionException { if ( inError ) { return ; } Object o = ic . peekObject ( ) ; if ( o != hook ) { addWarn ( "The object at the of the stack is not the hook pushed earlier." ) ; } else { ic . popObject ( ) ; Thread hookThread = new Thread ( hook , "Logback shutdown hook [" + context . getName ( ) + "]" ) ; addInfo ( "Registering shutdown hook with JVM runtime" ) ; context . putObject ( CoreConstants . SHUTDOWN_HOOK_THREAD , hookThread ) ; Runtime . getRuntime ( ) . addShutdownHook ( hookThread ) ; } }
Once the children elements are also parsed now is the time to activate the shutdown hook options .