diff --git a/tailer/src/main/java/de/swingbe/tailer/Main.java b/tailer/src/main/java/de/swingbe/tailer/Main.java index 28fcabb..4fced6e 100644 --- a/tailer/src/main/java/de/swingbe/tailer/Main.java +++ b/tailer/src/main/java/de/swingbe/tailer/Main.java @@ -7,13 +7,30 @@ import java.io.File; public class Main { + //delay between checks of the file for new content in milliseconds + public static final int DELAY_MILLIS = 500; + + //set to true to tail from the end of the file, false to tail from the beginning of the file + public static final boolean END = true; + public static void main(String[] args) { System.out.println("Hello world!"); TailerListener listener = new MyListener(); - Tailer tailer = new Tailer(new File("NetPeerManager.log"), listener, 500); + + //create and use a Tailer with a Thread + String fileName = "NetPeerManager.log"; + //TODO What is the behaviour of the reOpen parameter? + Tailer tailer = new Tailer(new File(fileName), listener, DELAY_MILLIS, END); tailer.run(); + Thread thread = new Thread(tailer); + + //optional + thread.setDaemon(true); + + thread.start(); + return; } }