private void rotate ( ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , getFileName ( ) + ": Rotating output log" ) ; } try { this . myChannel . close ( ) ; } catch ( IOException ioe ) { FFDCFilter . processException ( ioe , getClass ( ) . getName ( ) + ".rotate" , "424" , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , getFileName ( ) + ": Failed to close the output file; " + ioe ) ; } } try { if ( 0 < getMaximumBackupFiles ( ) ) { // add the new backup file to the stored list addBackup ( ) ; } this . myChannel = new FileOutputStream ( this . myFile , true ) . getChannel ( ) ; } catch ( SecurityException se ) { FFDCFilter . processException ( se , getClass ( ) . getName ( ) + ".rotate" , "436" , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , getFileName ( ) + ": security error in rotate; " + se ) ; } } catch ( Throwable t ) { FFDCFilter . processException ( t , getClass ( ) . getName ( ) + ".rotate" , "441" , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( tc , getFileName ( ) + ": error in rotate; " + t ) ; } } }
When the output file has reached it s maximum size this code will rotate the current log to a backup and get ready to start logging with a new file .