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.

Reply via email to