Search in sources :

Example 1 with TailerListener

use of org.apache.commons.io.input.TailerListener in project solr-cmd-utils by tblsoft.

the class Test method tailer.

@org.junit.Test
@Ignore
public void tailer() throws Exception {
    TailerListener listener = new MyTailerListener();
    Tailer tailer = Tailer.create(new File("/tmp/artifacts/solr.log"), listener, 1000, true);
    tailer.run();
}
Also used : Tailer(org.apache.commons.io.input.Tailer) File(java.io.File) TailerListener(org.apache.commons.io.input.TailerListener) Ignore(org.junit.Ignore)

Example 2 with TailerListener

use of org.apache.commons.io.input.TailerListener in project app-maven-plugin by GoogleCloudPlatform.

the class TailingVerifier method startTailingLog.

private void startTailingLog() {
    TailerListener listener = new TailerListenerAdapter() {

        @Override
        public void handle(String line) {
            System.out.println(testName + ": " + line);
        }
    };
    // Tail the log
    File file = new File(getBasedir() + File.separator + getLogFileName());
    try {
        if (file.exists()) {
            file.delete();
        }
        file.createNewFile();
    } catch (IOException e) {
        e.printStackTrace();
    }
    Tailer tailer = new Tailer(file, listener, TAIL_DELAY_MILLIS);
    Thread thread = new Thread(tailer);
    thread.setDaemon(true);
    thread.start();
}
Also used : Tailer(org.apache.commons.io.input.Tailer) IOException(java.io.IOException) TailerListenerAdapter(org.apache.commons.io.input.TailerListenerAdapter) File(java.io.File) TailerListener(org.apache.commons.io.input.TailerListener)

Aggregations

File (java.io.File)2 Tailer (org.apache.commons.io.input.Tailer)2 TailerListener (org.apache.commons.io.input.TailerListener)2 IOException (java.io.IOException)1 TailerListenerAdapter (org.apache.commons.io.input.TailerListenerAdapter)1 Ignore (org.junit.Ignore)1