1

I have folder with logs. I want to realize following functionality: output to console only fresh added log entryes.

for example at 13-00 I have launched application: logs before 13-00 shouldn't output in console(I mean console of my read log application. it is separate application). 13-01 in log1.txt was written new entry(13-01 : very important information); - expected behavoiur - to see this entry in console. I know about WatchService My knowledge that this class can only show that log1.txt was modified. But I want to show in console "diff" In my case it is 13-01 : very important information

Can you advice best tool for resolving this problem?

11
  • Usually this is done with a logging library. Each such library provides the functionality to define several appenders and write log info to all of them. So your log entries are written to the file and the console. You really should use such a logging library. Jun 17, 2014 at 11:33
  • My problem - I want get notification about some type of logs Jun 17, 2014 at 11:36
  • There are some very popular logging libraries for Java. Use your favorite web search, and you will find them. Suggesting a library is highly opinion-based. I know about log4j, logback, and even the Java integrated logging facility (JUL) is ok. And then their are wrappers like Apache Commons Logging and slf4j. Jun 17, 2014 at 11:37
  • @Seelenvirtuose I have a lot of log files. Problem - configure NOTIFICATION Jun 17, 2014 at 11:38
  • With a logging library you do not configure any notification mechanism. You simply write the same logging info to several destinations. Each such destination may have its own rules, what exactly to write out. Jun 17, 2014 at 11:43

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.