You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Steve Kuo <st...@yahoo.com> on 2005/05/03 23:49:32 UTC
Set maximum number of errors for a logger instance?
We're using a third party product (JGroups) which
instead of logging an error just once, keeps logging
the same error repeatedly. This is annoying as it
fills up the log file.
Is there a way to configure log4j to only log an error
so many times (for a particular logger instance)?
After the maximum error threshold is met, then ignore
all further errors.
Thanks, Steve
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: Set maximum number of errors for a logger instance?
Posted by Paul Smith <ps...@aconex.com>.
This is quite easy if you code yourself a little Filter class. An
appender can be given a Filter, so create a Filter impl that takes the
event, works out whether it's the type that's been trapped before, and
return Filter.DENY if you don't want to see it.
The class should only be a handful of lines of code for you.
cheers,
Paul Smith
Steve Kuo wrote:
>We're using a third party product (JGroups) which
>instead of logging an error just once, keeps logging
>the same error repeatedly. This is annoying as it
>fills up the log file.
>
>Is there a way to configure log4j to only log an error
>so many times (for a particular logger instance)?
>After the maximum error threshold is met, then ignore
>all further errors.
>
>Thanks, Steve
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org