title: Log monitor problem with Java and org.apache.commons.io.input.Tailer
body: <p>I am trying to use this to monitor a log file and put the log lines in a database as they come in. The problem I am having is that it seems while the thread containing my TailerListener is running, I cannot delete or rename the log file. This being the case, I am not sure how this will react when the log file rolls over, which happens nightly. I glanced at the code for Tailer and it appears to handle log rollover, but I can't see how when the file being monitored is basically locked.</p>
  
  <p>There should be no reason the file cannot be deleted as I am only reading from it. I would think once the file was deleted/renamed it would simply throw some type of exception. Especially since Tailer seems to be written aiming at the functionality of "tail -f".</p>
  
  <p>The exact error I am getting when trying to delete the file: "This action can't be completed because the file is open in Java(TM) Platform SE binary"</p>
  
  <p>Here is the sample code from my project:</p>
  
  <p><pre><code>
  public static void main(String[] args) {
          // TODO code application logic here
          File pcounter_log = new File("c:\development\temp\test.log");</p>
  
  <pre><code>    try {
          TailerListener listener = new PCTailListener();
          Tailer tailer = new Tailer(pcounter_log, listener, 5000);
  
          Thread thread = new Thread(tailer);
          thread.start();
      } catch (Exception e) {
          System.out.println(e);
      }
  }
  </code></pre>
  
  <p></pre></code></p>
  
  <p><pre><code>
  public class PCTailListener extends TailerListenerAdapter {
   public void handle(String line) {
    System.out.println(line);
   }
  }
  </pre></code></p>
  
  <p>Any information on this regarding Tailer specificially, file handling in Java, anything that might put me on the right track is greatly appreciated.</p>