Ralph,<div><br></div><div>Thanks for your suggestion - after a quick skim through the documentation it certainly looks like markers may provide the behaviour I'm looking for - will give that a try.</div><div><br></div>
<div>Regards,</div><div><br></div><div>Shane</div><div class="gmail_extra"><br><br><div class="gmail_quote">On 15 December 2012 00:23, Ralph Goers <span dir="ltr"><<a href="mailto:rgoers@apache.org" target="_blank">rgoers@apache.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><br></div><div>See <a href="http://logback.qos.ch/manual/filters.html#levelFilter" target="_blank">http://logback.qos.ch/manual/filters.html#levelFilter</a></div>
<div><br></div><div>Ralph</div><div><br></div><div><div><div class="h5"><div>On Dec 14, 2012, at 6:40 AM, Benoît Thiébault wrote:</div><br></div></div><blockquote type="cite"><div><div class="h5"><div style="word-wrap:break-word">
Hi everyone,<div><br></div><div>I have developed a custom LogBack appender and I would like it to receive only log messages of a given level. I don't want to hard code it in the class, but to set it in the XML configuration file.</div>
<div><br></div><div>I thought something like this would work (but it doesn't):</div><div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco;color:rgb(56,52,255)">
<span style="color:#009193"><</span><span style="color:#4d9192">root</span><span style="color:#000000"> </span><span style="color:#932192">level</span><span style="color:#000000">=</span>"trace"<span style="color:#009193">></span></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco;color:rgb(77,145,146)"><span style="color:#000000"><span style="white-space:pre-wrap"> </span></span><span style="color:#009193"><</span>appender-ref<span style="color:#000000"> </span><span style="color:#932192">ref</span><span style="color:#000000">=</span><span style="color:#3834ff">"FILE"</span><span style="color:#000000"> </span><span style="color:#009193">/></span></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco;color:rgb(56,52,255)"><span style="color:#000000"><span style="white-space:pre-wrap"> </span></span><span style="color:#009193"><</span><span style="color:#4d9192">appender-ref</span><span style="color:#000000"> </span><span style="color:#932192">ref</span><span style="color:#000000">=</span>"MyTraceAppender"<span style="color:#000000"> </span><span style="color:#009193">/></span></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco;color:rgb(56,52,255)"><span style="color:#000000"><span style="white-space:pre-wrap"> </span></span><span style="color:#009193"><</span><span style="color:#4d9192">appender-ref</span><span style="color:#000000"> </span><span style="color:#932192">ref</span><span style="color:#000000">=</span>"MyInfoAppender" <span style="color:rgb(147,33,146)">level</span><span style="color:rgb(0,0,0)">=</span>"info"<span style="color:#009193">/></span></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco;color:rgb(77,145,146)"><span style="color:#009193"></</span>root<span style="color:#009193">></span></div>
</div><div><br></div><div>I also tried something like:</div><div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco;color:rgb(56,52,255)"><span style="color:#009193"><</span><span style="color:#4d9192">appender</span><span style="color:#000000"> </span><span style="color:#932192">name</span><span style="color:#000000">=</span>"MyTraceAppender<span>"<span style="color:#000000"> </span><span style="color:#932192">class</span><span style="color:#000000">=</span>"org.test.MyLogger1"<span style="color:#009193">/></span></span></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco;color:rgb(56,52,255)"><span><span style="color:#009193"><</span><span style="color:#4d9192">appender</span><span style="color:#000000"> </span><span style="color:#932192">name</span><span style="color:#000000">=</span>"</span>MyInfoAppender<span>"<span style="color:#000000"> </span><span style="color:#932192">class</span><span style="color:#000000">=</span>"</span>org.test.MyLogger2<span>"<span style="color:#000000"> </span><span style="color:#932192">level</span><span style="color:#000000">=</span>"info"<span style="color:#009193">/></span></span></div>
</div><div><br></div><div>No luck either.</div><div><br></div><div>It seems only loggers can be assigned a threshold level. So I though about something like this:</div><div><div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco;color:rgb(147,33,146)">
<span style="color:#009193"><</span><span style="color:#4d9192">logger</span><span style="color:#000000"> </span>name<span style="color:#000000">=</span><span style="color:#3834ff">"test"</span><span style="color:#000000"> </span>level<span style="color:#000000">=</span><span style="color:#3834ff">"info"</span><span style="color:#009193">></span></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco"> <span style="color:rgb(0,145,147)"><</span><span style="color:rgb(77,145,146)">appender-ref</span><span style> </span><span style="color:rgb(147,33,146)">ref</span><span style>=</span><font color="#3834ff">"MyInfoAppender</font><span style="color:rgb(56,52,255)">"<span style="color:#000000"> </span><span style="color:#009193">/></span></span></div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font:normal normal normal 11px/normal Monaco;color:rgb(77,145,146)"><span style="color:#009193"></</span>logger<span style="color:#009193">></span></div>
</div><div><br></div><div>but this would only log messages sent by classes whose package is test. *... And I want to log anything.</div><div><br></div><div>Can anyone help?</div><div><br></div><div>Thanks</div><div>Ben</div>
</div></div></div>_______________________________________________<br>Logback-user mailing list<br><a href="mailto:Logback-user@qos.ch" target="_blank">Logback-user@qos.ch</a><br><a href="http://mailman.qos.ch/mailman/listinfo/logback-user" target="_blank">http://mailman.qos.ch/mailman/listinfo/logback-user</a></blockquote>
</div><br></div><br>_______________________________________________<br>
Logback-user mailing list<br>
<a href="mailto:Logback-user@qos.ch">Logback-user@qos.ch</a><br>
<a href="http://mailman.qos.ch/mailman/listinfo/logback-user" target="_blank">http://mailman.qos.ch/mailman/listinfo/logback-user</a><br></blockquote></div><br></div>