Search in sources :

Example 6 with Tailer

use of org.apache.commons.io.input.Tailer 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

Tailer (org.apache.commons.io.input.Tailer)6 File (java.io.File)4 HashSet (java.util.HashSet)2 TailerListener (org.apache.commons.io.input.TailerListener)2 Appender (org.apache.logging.log4j.core.Appender)2 FileAppender (org.apache.logging.log4j.core.appender.FileAppender)2 MemoryMappedFileAppender (org.apache.logging.log4j.core.appender.MemoryMappedFileAppender)2 RandomAccessFileAppender (org.apache.logging.log4j.core.appender.RandomAccessFileAppender)2 RollingFileAppender (org.apache.logging.log4j.core.appender.RollingFileAppender)2 RollingRandomAccessFileAppender (org.apache.logging.log4j.core.appender.RollingRandomAccessFileAppender)2 IOException (java.io.IOException)1 TailerListenerAdapter (org.apache.commons.io.input.TailerListenerAdapter)1 ServerLogPatternListener (org.jboss.additional.testsuite.jdkall.present.shared.ServerLogPatternListener)1 Ignore (org.junit.Ignore)1 Test (org.junit.Test)1