[logback-user] How can I monitor the actual size of the asyncappender queue?

haobo liu lhbazazazv at gmail.com
Fri May 28 08:51:39 CEST 2021


in xml the name like
<appender name="async" class="ch.qos.logback.classic.AsyncAppender">
    <queueSize>500</queueSize>
    <discardingThreshold>0</discardingThreshold>
    <appender-ref ref="info"/>
</appender>

KARR, DAVID <dk068x at att.com> 于2021年5月28日周五 下午1:32写道:


KARR, DAVID <dk068x at att.com> 于2021年5月28日周五 下午1:32写道:

> > -----Original Message-----
> > From: logback-user <logback-user-bounces at qos.ch> On Behalf Of haobo liu
> > Sent: Thursday, May 27, 2021 6:30 PM
> > To: logback users list <logback-user at qos.ch>
> > Subject: Re: [logback-user] How can I monitor the actual size of the
> > asyncappender queue?
> >
> > maybe ch.qos.logback.core.AsyncAppenderBase#getNumberOfElementsInQueue
> >  or hack the code add a volatile variable (bad idea)
>
> Ok, then the next question is how do I access this from code?  I see that
> Logger's base hierarchy has a "getAppender(String)" method.  What is the
> input parameter for that?
>
> Once I solve that, I guess I have to think about whether it makes sense to
> write occasional log messages that print the current queue size (which
> would obviously go into the queue).  I wonder if I can render it in a JMX
> property?
>
> > KARR, DAVID <dk068x at att.com> 于2021年5月28日周五 上午12:02写道:
> > >
> > > I believe I now understand the basic mechanics of the AsyncAppender
> > queue, and the tradeoffs of having it small or large.
> > >
> > > What's not obvious to me is how I can monitor the utilization of the
> > queue, perhaps in a load test.  I did notice there is a "listener"
> > mechanism, and one example I believe illustrates how I can detect when
> > logs are dropped because the queue is full, but I want to get an idea of
> > how well the queue size is being utilized, or how close it's getting to
> > being full.
> > > _______________________________________________
> > > logback-user mailing list
> > > logback-user at qos.ch
> > >
> > https://urldefense.com/v3/__http://mailman.qos.ch/mailman/listinfo/logba
> > ck-user__;!!BhdT!3fKeEphTUa7E0aTa8d_CL5pew3dk2J9fS4P9e8p-
> > IzfqusHDdGdZTnCCLSQO_g$
> > _______________________________________________
> > logback-user mailing list
> > logback-user at qos.ch
> > https://urldefense.com/v3/__http://mailman.qos.ch/mailman/listinfo/logba
> > ck-user__;!!BhdT!3fKeEphTUa7E0aTa8d_CL5pew3dk2J9fS4P9e8p-
> > IzfqusHDdGdZTnCCLSQO_g$
> _______________________________________________
> logback-user mailing list
> logback-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/logback-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20210528/5529aff0/attachment-0001.html>


More information about the logback-user mailing list