1

I'm trying to collect some advices on error logging in java. My log file is huge and going trough it is time consuming, currently I'm grep(ing) my log looking for error(ERROR) pattern, and then looking at line which threw exception then I search/find it and check out the error.

Is there some better way of reading log files more efficiently? Currently my focus is on errors/exceptions only.

I've titled my question wrongly(edit)

I'm not interesting about logging, I'm interested about log processing(post-logging) process, I have the log and I have to get useful information from it(for me errors).

ant
  • 22,634
  • 36
  • 132
  • 182
  • http://stackoverflow.com/questions/296150/what-are-the-best-practices-to-log-an-error – jmj Oct 18 '10 at 12:51
  • The title of your post is not very informative - could be improved to e.g. "How to extract error info from Java log files". – Péter Török Oct 18 '10 at 12:52
  • @Péter Török You're right I admit, I edited my question – ant Oct 18 '10 at 12:54
  • Here's a developer snapshot of the latest version of Chainsaw - lots of new features..release coming soon: http://people.apache.org/~sdeboy – Scott Oct 22 '10 at 08:00

3 Answers3

3

If you are using log4j I recommend you to take a look at Chainsaw: http://logging.apache.org/chainsaw/index.html

Alois Cochard
  • 9,812
  • 2
  • 29
  • 30
1

You don't say what you're using for a logging framework, but I believe that Log4J will allow you to split different levels to different appenders.

And it looks like this question shows how: Log Level per appender for a single Logger

Community
  • 1
  • 1
Anon
  • 2,654
  • 16
  • 10
1

If you're looking for simplicity and good community support, I'd try Microsoft's Log Parser. It uses a SQL-like query system to search logs in any format.

neocotic
  • 2,131
  • 18
  • 18