public void activateOptions ( ) { getLogger ( ) . info ( "activateOptions" ) ; active = true ; Runnable runnable = new Runnable ( ) { public void run ( ) { initialize ( ) ; while ( reader == null ) { getLogger ( ) . info ( "attempting to load file: " + getFileURL ( ) ) ; try { reader = new InputStreamReader ( new URL ( getFileURL ( ) ) . openStream ( ) ) ; } catch ( FileNotFoundException fnfe ) { getLogger ( ) . info ( "file not available - will try again" ) ; synchronized ( this ) { try { wait ( MISSING_FILE_RETRY_MILLIS ) ; } catch ( InterruptedException ie ) { } } } catch ( IOException ioe ) { getLogger ( ) . warn ( "unable to load file" , ioe ) ; return ; } } try { BufferedReader bufferedReader = new BufferedReader ( reader ) ; createPattern ( ) ; do { process ( bufferedReader ) ; try { synchronized ( this ) { wait ( waitMillis ) ; } } catch ( InterruptedException ie ) { } if ( tailing ) { getLogger ( ) . debug ( "tailing file" ) ; } } while ( tailing ) ; } catch ( IOException ioe ) { //io exception - probably shut down getLogger ( ) . info ( "stream closed" ) ; } getLogger ( ) . debug ( "processing " + path + " complete" ) ; shutdown ( ) ; } } ; if ( useCurrentThread ) { runnable . run ( ) ; } else { new Thread ( runnable , "LogFilePatternReceiver-" + getName ( ) ) . start ( ) ; } }
Read and process the log file .