protected synchronized void checkRollOver ( ) { // check to see if we should roll over the log String newDayStamp = _dayFormat . format ( new Date ( ) ) ; // hey! we need to roll it over! if ( ! newDayStamp . equals ( _dayStamp ) ) { log ( "log_closed" ) ; _logWriter . close ( ) ; _logWriter = null ; // rename the old file String npath = _logPath . getPath ( ) + "." + _dayStamp ; if ( ! _logPath . renameTo ( new File ( npath ) ) ) { log . warning ( "Failed to rename audit log file" , "path" , _logPath , "npath" , npath ) ; } // open our new log file openLog ( false ) ; // and set the next day stamp _dayStamp = newDayStamp ; } scheduleNextRolloverCheck ( ) ; }
Check to see if it s time to roll over the log file .