I am using TailerListener API for monitoring log files. It's working fine if process started. If we restart the TailerListener,ii is monitoring logs which are older than this process start up tim开发者_如何学Ce. Is there any way to avoid this.
Thanks in advance.
File
in java has a lastModified()
method. Before creating the Tailer
, check it.
Is your file being rotated? See if below is what you are asking, because I have run into this before. When the file is rotated the default behavior seems to be to spit out all the log message from the whole log file, instead of only new log messages. So my question would be, how do I override fileRotated() in TailerListener or change the behavior to avoid rolling the whole log file again (old and new messages)?
精彩评论