title: Apache Commons IO Tailer example
body: <p>I am working on a monitoring program that reads the /var/log/auth.log file. I am using Apache Commons IO <a href="http://commons.apache.org/proper/commons-io/apidocs/org/apache/commons/io/input/Tailer.html"><code>Tailer</code></a> class to read the file in real time. To get started, I wanted to test the real-time reading part on a simple file, and manually enter some code in the console line. Here is my code:</p>
  
  <pre><code>public class Main {
      public static void main(String[] args) {
          TailerListener listener = new MyListener();
          Tailer tailer = Tailer.create(new File("log.txt"), listener, 500);
          while(true) {
  
          }
      }
  }
  
  public class MyListener extends TailerListenerAdapter {
      @Override
      public void handle(String line) {
          System.out.println(line);
      }
  }
  </code></pre>
  
  <p>And from the terminal : <code>sudo echo "Hello" &gt;&gt; log.txt</code>
  The problem is when I try to write manually something in the file, it does not print it in the console. I tried to find a concrete example of usage of Tailer class, but no luck. What am I doing wrong here?</p>