@ Override public synchronized void shutdown ( ) { try { if ( open ) { open = false ; FileWriter logWriter = new FileWriter ( logFile ) ; logWriter . write ( buffer . toString ( ) ) ; logWriter . close ( ) ; } } catch ( IOException e ) { logger . error ( "Error shutting down" , e ) ; } }
On the first call to this method write the buffer to the log file . Set the flag so no more logging calls will be accepted .