2

I've got a huge number of log messages in project's log. I want to reduce that number by logging only first N of them for every line of code where log is used.

Are there any existent solutions for my task? Thanks in advance.

1
  • Couldn't you simply use the debug level for filtering or log rotation? Jul 13, 2012 at 7:30

2 Answers 2

2

This is not something i have tried myself, but if you use logback as the underlying logging mechanism of slf4j, I imagine you could write a custom filter that takes care of filtering the log output as you specify it.

http://logback.qos.ch/manual/filters.html

0

I decided to implement a LoggerWrapper by myself.

We can obtain the current line of a caller, count its occurrence and decide whether print a message or not. I think it's quite simple but a kind of routine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.