0

I have the following code,

public class Identifier extends TailerListenerAdapter {
     public static void main(String args[]) throws InterruptedException {

        TailerListener listener = new Identifier();
        Tailer tailer = new Tailer(inputFile, listener, 500);
        tailer.run();
        while (true){

        }
    }

    @Override
    public void handle(String line) {
        super.handle(line);
        System.out.println(line);
    }
}

This is the total code I am using for the tailing service, I have a file which contains more that 100K lines but the tailer only prints first 20 line.

What I am missing, I have also tried using the thread like this.

Thread tailerThread = new Thread(tailer);
tailerThread.start();
Root
  • 955
  • 1
  • 16
  • 39
  • See https://stackoverflow.com/questions/22987170/apache-commons-io-tailer-example – Ori Marko Jul 13 '17 at 13:57
  • The answer that got the 10 up vote is just removing the loop as far as I understand, this thing stop the tailer after processing 20 lines. – Root Jul 13 '17 at 14:02
  • It works fine of small file but not on the file which contains 1000k lines. – Root Jul 13 '17 at 15:25

0 Answers0