protected void checkLimit ( ) { synchronized ( this . getSyncObject ( ) ) { if ( this . byteLimit != - 1 && this . traceLogfile != null && this . traceLogfile . length ( ) > this . byteLimit ) { close ( ) ; int pos = this . traceLogfile . getAbsolutePath ( ) . lastIndexOf ( ' ' ) ; String splitFilename = this . traceLogfile . getAbsolutePath ( ) . substring ( 0 , pos ) + "." + ( ++ this . counter ) + ".log" ; File splitFile = new File ( splitFilename ) ; if ( splitFile . exists ( ) ) { if ( ! splitFile . delete ( ) ) System . err . printf ( "WARNING: Couldn't delete old file: %s%n" , splitFile . getName ( ) ) ; } this . traceLogfile . renameTo ( splitFile ) ; open ( ) ; } } }
Checks if the file size limit has been exceeded and splits the trace file if need be .