use of org.apache.commons.io.input.Tailer in project cas by apereo.
the class LoggingOutputSocketMessagingController method registerLogFileTailThreads.
private void registerLogFileTailThreads() throws IOException {
final Collection<String> outputFileNames = new HashSet<>();
final Collection<Appender> loggerAppenders = this.loggerContext.getConfiguration().getAppenders().values();
loggerAppenders.forEach(appender -> {
if (appender instanceof FileAppender) {
outputFileNames.add(((FileAppender) appender).getFileName());
} else if (appender instanceof RandomAccessFileAppender) {
outputFileNames.add(((RandomAccessFileAppender) appender).getFileName());
} else if (appender instanceof RollingFileAppender) {
outputFileNames.add(((RollingFileAppender) appender).getFileName());
} else if (appender instanceof MemoryMappedFileAppender) {
outputFileNames.add(((MemoryMappedFileAppender) appender).getFileName());
} else if (appender instanceof RollingRandomAccessFileAppender) {
outputFileNames.add(((RollingRandomAccessFileAppender) appender).getFileName());
}
});
outputFileNames.forEach(s -> {
final Tailer t = new Tailer(new File(s), new LogTailerListener(), 100, false, true);
final Thread thread = new Thread(t);
thread.setPriority(Thread.MIN_PRIORITY);
thread.setName(s);
thread.start();
});
}
use of org.apache.commons.io.input.Tailer in project cas by apereo.
the class LoggingOutputTailingService method registerLogFileTailersForExecution.
private void registerLogFileTailersForExecution(final LoggerContext loggerContext) {
final Collection<String> outputFileNames = new HashSet<>();
final Collection<Appender> loggerAppenders = loggerContext.getConfiguration().getAppenders().values();
loggerAppenders.forEach(appender -> {
if (appender instanceof FileAppender) {
outputFileNames.add(FileAppender.class.cast(appender).getFileName());
} else if (appender instanceof RandomAccessFileAppender) {
outputFileNames.add(RandomAccessFileAppender.class.cast(appender).getFileName());
} else if (appender instanceof RollingFileAppender) {
outputFileNames.add(RollingFileAppender.class.cast(appender).getFileName());
} else if (appender instanceof MemoryMappedFileAppender) {
outputFileNames.add(MemoryMappedFileAppender.class.cast(appender).getFileName());
} else if (appender instanceof RollingRandomAccessFileAppender) {
outputFileNames.add(RollingRandomAccessFileAppender.class.cast(appender).getFileName());
}
});
outputFileNames.forEach(f -> {
final Tailer t = new Tailer(new File(f), this, 100L, false, true);
this.tailers.add(t);
this.taskExecutor.execute(t);
});
}
use of org.apache.commons.io.input.Tailer in project spring-integration by spring-projects.
the class ApacheCommonsFileTailingMessageProducer method doStart.
@Override
protected void doStart() {
super.doStart();
Tailer tailer = new Tailer(this.getFile(), this, this.pollingDelay, this.end, this.reopen);
this.getTaskExecutor().execute(tailer);
this.tailer = tailer;
}
use of org.apache.commons.io.input.Tailer 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();
}
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();
}
Aggregations