<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"MS Gothic";
panose-1:2 11 6 9 7 2 5 8 2 4;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
{font-family:"\@MS Gothic";
panose-1:2 11 6 9 7 2 5 8 2 4;}
@font-face
{font-family:"Source Code Pro";
panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0in;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:Consolas;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Ok, that’s perfect, thanks.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> logback-user <logback-user-bounces@qos.ch> <b>On Behalf Of
</b>haobo liu<br>
<b>Sent:</b> Friday, May 28, 2021 6:01 PM<br>
<b>To:</b> logback users list <logback-user@qos.ch><br>
<b>Subject:</b> Re: [logback-user] How can I monitor the actual size of the asyncappender queue?<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">The code like <o:p></o:p></p>
<div>
<pre style="background:#272822"><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#52E3F6">LoggerContext </span><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#CFBFAD">loggerContext </span><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#FF007F">= </span><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#F9FAF4">(</span><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#52E3F6">LoggerContext</span><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#F9FAF4">) </span><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#52E3F6">LoggerFactory</span><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#FF007F">.</span><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#CFBFAD">getILoggerFactory</span><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#F9FAF4">()</span><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#FF007F">;<br></span><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#52E3F6">ch.qos.logback.classic.Logger </span><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#CFBFAD">logger </span><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#FF007F">= </span><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#CFBFAD">loggerContext</span><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#FF007F">.</span><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#A7EC21">getLogger</span><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#F9FAF4">(</span><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#52E3F6">Logger</span><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#FF007F">.</span><b><i><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#1948A6">ROOT_LOGGER_NAME</span></i></b><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#F9FAF4">)</span><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#FF007F">;<br></span><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#52E3F6">AsyncAppender </span><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#CFBFAD">sync </span><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#FF007F">= </span><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#F9FAF4">(</span><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#52E3F6">AsyncAppender</span><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#F9FAF4">) </span><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#CFBFAD">logger</span><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#FF007F">.</span><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#A7EC21">getAppender</span><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#F9FAF4">(</span><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#ECE47E">"async"</span><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#F9FAF4">)</span><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#FF007F">;<br>int </span><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#CFBFAD">numberOfElementsInQueue </span><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#FF007F">= </span><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#CFBFAD">sync</span><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#FF007F">.</span><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#A7EC21">getNumberOfElementsInQueue</span><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#F9FAF4">()</span><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#FF007F">;</span><span style="font-size:13.0pt;font-family:"Source Code Pro",serif;color:#CFBFAD"><o:p></o:p></span></pre>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">KARR, DAVID <<a href="mailto:dk068x@att.com">dk068x@att.com</a>>
<span style="font-family:"MS Gothic"">于</span>2021<span style="font-family:"MS Gothic"">年</span>5<span style="font-family:"MS Gothic"">月</span>28<span style="font-family:"MS Gothic"">日周五</span>
<span style="font-family:"MS Gothic"">下午</span>11:09<span style="font-family:"MS Gothic"">写道:</span><o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Thanks for replying, but I think you’re missing the point. I’m well aware of how to define an AsyncAppender. I’m investigating how to properly monitor the size of the queue.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><b>From:</b> logback-user <<a href="mailto:logback-user-bounces@qos.ch" target="_blank">logback-user-bounces@qos.ch</a>>
<b>On Behalf Of </b>haobo liu<br>
<b>Sent:</b> Thursday, May 27, 2021 11:52 PM<br>
<b>To:</b> logback users list <<a href="mailto:logback-user@qos.ch" target="_blank">logback-user@qos.ch</a>><br>
<b>Subject:</b> Re: [logback-user] How can I monitor the actual size of the asyncappender queue?<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">in xml the name like<br>
<appender name="<span style="color:black;background:red">async</span>" class="ch.qos.logback.classic.AsyncAppender"><br>
<queueSize>500</queueSize><br>
<discardingThreshold>0</discardingThreshold><br>
<appender-ref ref="info"/><br>
</appender><br>
<br>
KARR, DAVID <<a href="mailto:dk068x@att.com" target="_blank">dk068x@att.com</a>> <span style="font-family:"MS Gothic"">
于</span>2021<span style="font-family:"MS Gothic"">年</span>5<span style="font-family:"MS Gothic"">月</span>28<span style="font-family:"MS Gothic"">日周五</span>
<span style="font-family:"MS Gothic"">下午</span>1:32<span style="font-family:"MS Gothic"">写道:</span><o:p></o:p></p>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;margin-bottom:12.0pt"> <o:p></o:p></p>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">KARR, DAVID <<a href="mailto:dk068x@att.com" target="_blank">dk068x@att.com</a>>
<span style="font-family:"MS Gothic"">于</span>2021<span style="font-family:"MS Gothic"">年</span>5<span style="font-family:"MS Gothic"">月</span>28<span style="font-family:"MS Gothic"">日周五</span>
<span style="font-family:"MS Gothic"">下午</span>1:32<span style="font-family:"MS Gothic"">写道:</span><o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">> -----Original Message-----<br>
> From: logback-user <<a href="mailto:logback-user-bounces@qos.ch" target="_blank">logback-user-bounces@qos.ch</a>> On Behalf Of haobo liu<br>
> Sent: Thursday, May 27, 2021 6:30 PM<br>
> To: logback users list <<a href="mailto:logback-user@qos.ch" target="_blank">logback-user@qos.ch</a>><br>
> Subject: Re: [logback-user] How can I monitor the actual size of the<br>
> asyncappender queue?<br>
> <br>
> maybe ch.qos.logback.core.AsyncAppenderBase#getNumberOfElementsInQueue<br>
> or hack the code add a volatile variable (bad idea)<br>
<br>
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?<br>
<br>
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?<br>
<br>
> KARR, DAVID <<a href="mailto:dk068x@att.com" target="_blank">dk068x@att.com</a>>
<span style="font-family:"MS Gothic"">于</span>2021<span style="font-family:"MS Gothic"">年</span>5<span style="font-family:"MS Gothic"">月</span>28<span style="font-family:"MS Gothic"">日周五</span>
<span style="font-family:"MS Gothic"">上午</span>12:02<span style="font-family:"MS Gothic"">写道:</span><br>
> ><br>
> > I believe I now understand the basic mechanics of the AsyncAppender<br>
> queue, and the tradeoffs of having it small or large.<br>
> ><br>
> > What's not obvious to me is how I can monitor the utilization of the<br>
> queue, perhaps in a load test. I did notice there is a "listener"<br>
> mechanism, and one example I believe illustrates how I can detect when<br>
> logs are dropped because the queue is full, but I want to get an idea of<br>
> how well the queue size is being utilized, or how close it's getting to<br>
> being full.<br>
> > _______________________________________________<br>
> > logback-user mailing list<br>
> > <a href="mailto:logback-user@qos.ch" target="_blank">logback-user@qos.ch</a><br>
> ><br>
> <a href="https://urldefense.com/v3/__http:/mailman.qos.ch/mailman/listinfo/logba" target="_blank">
https://urldefense.com/v3/__http://mailman.qos.ch/mailman/listinfo/logba</a><br>
> ck-user__;!!BhdT!3fKeEphTUa7E0aTa8d_CL5pew3dk2J9fS4P9e8p-<br>
> IzfqusHDdGdZTnCCLSQO_g$<br>
> _______________________________________________<br>
> logback-user mailing list<br>
> <a href="mailto:logback-user@qos.ch" target="_blank">logback-user@qos.ch</a><br>
> <a href="https://urldefense.com/v3/__http:/mailman.qos.ch/mailman/listinfo/logba" target="_blank">
https://urldefense.com/v3/__http://mailman.qos.ch/mailman/listinfo/logba</a><br>
> ck-user__;!!BhdT!3fKeEphTUa7E0aTa8d_CL5pew3dk2J9fS4P9e8p-<br>
> IzfqusHDdGdZTnCCLSQO_g$<br>
_______________________________________________<br>
logback-user mailing list<br>
<a href="mailto:logback-user@qos.ch" target="_blank">logback-user@qos.ch</a><br>
<a href="https://urldefense.com/v3/__http:/mailman.qos.ch/mailman/listinfo/logback-user__;!!BhdT!zygZD28LPoEstVsFzbGd9YZbR4R-9OFO2K2ki5wJ9Np-MfEUCNBA43VFEuCv-A$" target="_blank">http://mailman.qos.ch/mailman/listinfo/logback-user</a><o:p></o:p></p>
</blockquote>
</div>
</div>
</div>
</div>
<p class="MsoNormal">_______________________________________________<br>
logback-user mailing list<br>
<a href="mailto:logback-user@qos.ch" target="_blank">logback-user@qos.ch</a><br>
<a href="https://urldefense.com/v3/__http:/mailman.qos.ch/mailman/listinfo/logback-user__;!!BhdT!1PlHvr-1RFXKYERKJ4Ts5_ZZD9B9KC13Rxuw-ENKyrzN94M076A277_uv4cgag$" target="_blank">http://mailman.qos.ch/mailman/listinfo/logback-user</a><o:p></o:p></p>
</blockquote>
</div>
</div>
</div>
</body>
</html>