如何避免TailerListener中的旧日志消息 [英] How to avoid old log messages in TailerListener

查看:179
本文介绍了如何避免TailerListener中的旧日志消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Apache Commons Tailer API监视日志文件.

I am using the Apache Commons Tailer API to monitor the log files.

每当我重新启动应用程序时,也会显示旧的日志消息.相反,应该仅显示新的日志消息.

Whenever I restart the application, old log messages are also displayed. Instead only new log messages should get displayed.

如何避免这种获取旧日志消息的行为?

How do I avoid this behavior of getting the old log messages?

推荐答案

您是否使用了

Did you use the 4-argument Tailer constructor and pass true for the last argument (end)? This should make sure that only new lines are returned.

最后一个参数记录如下:

The last argument is documented like this:

设置为true到文件末尾,false到文件末尾.

Set to true to tail from the end of the file, false to tail from the beginning of the file.

这篇关于如何避免TailerListener中的旧日志消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆