List of usage examples for org.apache.commons.io.input Tailer create
public static Tailer create(File file, TailerListener listener, long delay, boolean end)
From source file:org.ngrinder.operation.cotroller.LogMonitorController.java
/** * Initialize the {@link Tailer}./* w ww . j a v a2 s. c o m*/ */ private synchronized void initTailer() { File logFile = getLogFile(); if (tailer != null) { tailer.stop(); } tailer = Tailer.create(logFile, new TailerListenerAdapter() { /** * Handles a line from a Tailer. * * @param line * the line. */ public void handle(String line) { synchronized (this) { if (stringBuffer.length() + line.length() > 5000) { count++; modification = 0; stringBuffer = new StringBuffer(); } modification++; if (stringBuffer.length() > 0) { stringBuffer.append("<br>"); } stringBuffer.append(line.replace("\n", "<br>")); } } }, 1000, true); }