@ Override public void shutdown ( ) { // Stop the appender from delivering new messages to us ServiceManagerAppender . shutdown ( ) ; // Before shutting down synchronously transfer all the pending logs try { final LinkedList < LogLine > copy ; synchronized ( incoming ) { if ( ! incoming . isEmpty ( ) ) { // Take all the logs as they stand currently and forward them synchronously before shutdown copy = new LinkedList <> ( incoming ) ; incoming . clear ( ) ; } else { copy = null ; } } if ( copy != null ) { // Keep forwarding logs until we encounter an error (or run out of logs to forward) while ( ! copy . isEmpty ( ) && ( forwardLogs ( copy ) > 0 ) ) ; if ( ! copy . isEmpty ( ) ) log . warn ( "Shutdown called but failed to transfer all pending logs at time of shutdown to Service Manager: there are " + copy . size ( ) + " remaining" ) ; } } catch ( Throwable t ) { log . warn ( "Logging system encountered a problem during shutdown" , t ) ; } super . shutdown ( ) ; }
Shuts down the log forwarding