Hi Ralph,

Yes, that is the behavior I want ie all logs without a marker need to get
printed because they are placed in such a way that they don’t need any
throttling. The ones that need throttling will be logged using the marker.

However, I want different throttling for different markers. They all go to
the same log ie there is only one logger/appender.

So, is it possible to assign burst filters at a marker level?

Thanks,
Bharat.

On Mon, Jul 27, 2020 at 11:03 PM Ralph Goers <ralph.go...@dslextreme.com>
wrote:

> 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.2...@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-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org
>
>

Reply via email to