logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <ralph.go...@dslextreme.com>
Subject Re: Multiple burst filters
Date Tue, 28 Jul 2020 06:03:41 GMT
Your filter configuration says “If this is an event with a throttle marker continue checking.
If it is not a throttle marker log it, regardless of its logging level.” Is that really
what you want?

If you want to throttle different calls to different loggers independently than just put the
burst filter on the logger or the logger’s appender reference.

Ralph

> On Jul 27, 2020, at 10:32 PM, bharat naik <bharat.2511@gmail.com> wrote:
> 
> Hi,
> 
> I am using log4j2 in my project (2.11.1) and there are several places in my
> code where I need to throttle the logging, in case of exceptions, and hence
> wanted to use the burst filter.
> 
> However, I don’t see a way of using multiple burst filters with different
> rate and maxBurst for different logging invocations, all going to the same
> log file.
> 
> For example, what I have so far is:
> 
> <Filters>
>        <MarkerFilter marker="THROTTLE"onMatch="NEUTRAL" onMismatch="ACCEPT"
> />
>        <BurstFilter level="WARN" rate="1"maxBurst="1”/>
> </Filters>
> 
> and invoking it via:
> 
> A()
> {
> ..
> logger.warn(throttle, “msg”); <—throttle is a marker for “THROTTLE"
> ..
> }
> 
> B()
> {
> ..
> logger.warn(throttle, “msg”);
> ..
> }
> 
> However, instead if I could have multiple burst filters for different
> markers that would be ideal since currently I could miss log messages from
> B() and only log A() since they all go through one burst filter. Basically,
> I want to ensure at least one log output for every call to logger.warn(..),
> and throttle each of them independently.
> 
> Is that possible?
> 
> Thanks,
> Bharat.



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message