简体   繁体   English

如何一次监视多个日志文件

[英]How to monitor more than one log file at a time

Is there any Java API to monitor more than one log file at a time. 是否有任何Java API可以一次监视多个日志文件。 iein TailerListener we are able to monitor a single log file. TailerListener我们能够监视单个日志文件。

Please let me know if any Java API or any simple methods to monitor more than one log file. 请让我知道是否有任何Java API或任何简单的方法来监视多个日志文件。

Take a look at JNotify . 看看JNotify It uses the Linux inotify subsystem. 它使用Linux inotify子系统。

From the web page: 在网页上:

JNotify is a java library that allow java application to listen to file system events, such as:
 - File created 
 - File modified 
 - File renamed 
 - File deleted

There are a couple of other inotify implementations for java out there, and this is a good article on the topic. 还有一些其他的Java inotify实现,这是关于该主题的好文章

简单地创建多个Tailer对象使用相同的TailerListener实例。

I am not sure i understand the question. 我不确定我是否理解这个问题。 what exactly are you trying to do? 您到底想做什么?

and did you try using log4j? 您尝试使用log4j吗? if i understand the question you can make as many different log files as you like. 如果我理解这个问题,则可以根据需要创建尽可能多的不同日志文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM