public void checkForRotation ( ) { try { BufferedReader probe = new BufferedReader ( new FileReader ( file . getAbsoluteFile ( ) ) ) ; if ( firstLine == null || ( ! firstLine . equals ( probe . readLine ( ) ) ) ) { probe . close ( ) ; // start reading the file from the beginning reader . close ( ) ; reader = new BufferedReader ( new FileReader ( file . getAbsoluteFile ( ) ) ) ; firstLine = null ; offset = 0 ; } } catch ( IOException e ) { e . printStackTrace ( ) ; } }
Check whether the log file has been rotated . If so start reading the file from the beginning .