public class LogFileTailer extends Thread
This said you can also use the file tailer to read a file just once and exit. Use the doNotTail method to make it work that way.
Thread.State, Thread.UncaughtExceptionHandler
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
LogFileTailer(org.thales.punch.settings.api.ISettingsMap settings,
org.apache.logging.log4j.Logger logger,
File file,
long readInterval,
boolean startFromBeginning)
Creates a new log file tailer
|
Modifier and Type | Method and Description |
---|---|
LogFileTailer |
addLogFileTailerListener(LogFileTailerListener l)
add a listener
|
protected void |
fireNewLogFileLine(String line,
Map<String,String> properties) |
org.thales.punch.punchlang.util.ICodec<String> |
getCodec(org.thales.punch.settings.api.ISettingsMap settings)
Build specific codec from config
|
void |
readFile()
Use this method to read a file in a synchronous way.
|
LogFileTailer |
removeLogFileTailerListener(LogFileTailerListener l)
remove a listener
|
void |
run() |
LogFileTailer |
setTailling(boolean t)
enable/disable file tailing
|
void |
tick()
Flush buffer after timeout, tick is only implement for multiline codec
|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
public LogFileTailer(org.thales.punch.settings.api.ISettingsMap settings, org.apache.logging.log4j.Logger logger, File file, long readInterval, boolean startFromBeginning)
settings
- Spout settings to get codec typelogger
- Logfile
- The file to tailreadInterval
- Check interval for updates to the log file in msstartFromBeginning
- Should the tailer simply tail or should it process
the entire file and continue tailing (true) or
simply start tailing from the end of the filepublic LogFileTailer setTailling(boolean t)
t
- booleanpublic LogFileTailer addLogFileTailerListener(LogFileTailerListener l)
l
- the listenerpublic LogFileTailer removeLogFileTailerListener(LogFileTailerListener l)
l
- the listenerpublic void readFile()
public void tick()
public org.thales.punch.punchlang.util.ICodec<String> getCodec(org.thales.punch.settings.api.ISettingsMap settings)
settings
- the settings map with host port propertiesCopyright © 2023. All rights reserved.