<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta content="MSHTML 6.00.2900.6266" name="GENERATOR">
<!-- converted from rtf --><style>.EmailQuote {
PADDING-LEFT: 4pt; MARGIN-LEFT: 1pt; BORDER-LEFT: #800000 2px solid
}
</style>
</head>
<body dir="ltr">
<div><font face="Arial" color="#0000ff" size="2"><span class="261382806-10092012">Hi Andrew,</span></font></div>
<div><font face="Arial" color="#0000ff" size="2"><span class="261382806-10092012"></span></font> </div>
<div><font face="Arial" color="#0000ff" size="2"><span class="261382806-10092012">Thanks for the tip.</span></font></div>
<div><font face="Arial" color="#0000ff" size="2"><span class="261382806-10092012">However, I should have been more clear. I really *do* want to change the logging level.</span></font></div>
<div><font face="Arial" color="#0000ff" size="2"><span class="261382806-10092012"></span></font> </div>
<div><font face="Arial" color="#0000ff" size="2"><span class="261382806-10092012">Deployment&maintenance is done by third party, hence they decide what should be visible at each level (wish that wasn't the case, but...)</span></font></div>
<div><font face="Arial" color="#0000ff" size="2"><span class="261382806-10092012">Also, it means removing the appender for some cases, e.g.i</span></font><font face="Arial" color="#0000ff" size="2"><span class="261382806-10092012">f I want to 'upgrade' an error
to WARN & add a specific 'WARN' appender, it works. However, when I only want to see ERROR I also have to remove the appender. Now I know that, but as said, maintenance is not done by me...</span></font></div>
<div><font face="Arial" color="#0000ff" size="2"><span class="261382806-10092012"></span></font> </div>
<div><font face="Arial" color="#0000ff" size="2"><span class="261382806-10092012">Regards,</span></font></div>
<div><font face="Arial" color="#0000ff" size="2"><span class="261382806-10092012"></span></font> </div>
<div><font face="Arial" color="#0000ff" size="2"><span class="261382806-10092012">Koos</span></font></div>
<div><font face="Arial" color="#0000ff" size="2"></font> </div>
<div><br>
</div>
<div class="OutlookMessageHeader" lang="nl" dir="ltr" align="left">
<hr tabindex="-1">
<font face="Tahoma" size="2"><b>Van:</b> logback-user-bounces@qos.ch [mailto:logback-user-bounces@qos.ch]
<b>Namens </b>Andrew Bourgeois<br>
<b>Verzonden:</b> vrijdag 7 september 2012 18:47<br>
<b>Aan:</b> logback users list<br>
<b>Onderwerp:</b> Re: [logback-user] Modifying a logging events' level<br>
</font><br>
</div>
<div></div>
<div dir="ltr">
<div style="FONT-SIZE: 12pt; COLOR: #000000; FONT-FAMILY: 'Calibri'">
<div>hello Koos</div>
<div> </div>
<div></div>
<div>I don’t know how to change the logging level itself, but I assume that what you actually want to do is log these WARN messages with a configuration that has the rootLogger configured at ERROR level.</div>
<div>If that’s the case, you can simply declare a separate logger for the packages of that third-party library. In Groovy configuration that gives us:</div>
<div> </div>
<div></div>
<div></div>
<div>import ch.qos.logback.classic.encoder.PatternLayoutEncoder</div>
<div>import ch.qos.logback.core.FileAppender</div>
<div>import static ch.qos.logback.classic.Level.*</div>
<div> </div>
<div></div>
<div>appender("someAppender", FileAppender) {</div>
<div> file = "/var/log/test/rootLog.log"</div>
<div> encoder(PatternLayoutEncoder) {</div>
<div> pattern = "%date{yyyy-MM-dd HH:mm:ss,SSS} [%thread] %-5level - \\(%logger\\) - %message%n"</div>
<div> }</div>
<div>}</div>
<div> </div>
<div></div>
<div>root(ERROR, ["someAppender"])</div>
<div> </div>
<div></div>
<div>// =======================================================</div>
<div>// This is the logger that will allow WARN messages of your third-party library to log its WARN messages (and above) to the same appender the rootLogger is using.</div>
<div>// "logger(...)" documentation can be found here: http://logback.qos.ch/manual/groovy.html</div>
<div>// =======================================================</div>
<div>logger("com.thirdparty.lib", WARN, ["someAppender"], false)</div>
<div><font face="Arial" color="#0000ff" size="2"></font> </div>
<div></div>
<div></div>
<div>Best regards</div>
<div></div>
<div>Andrew Bourgeois</div>
<div style="DISPLAY: inline; FONT-WEIGHT: normal; FONT-SIZE: small; COLOR: #000000; FONT-STYLE: normal; FONT-FAMILY: 'Calibri'; TEXT-DECORATION: none">
<div style="FONT: 10pt tahoma">
<div> </div>
<div style="BACKGROUND: #f5f5f5">
<div style="font-color: black"><b>From:</b> <a title="K.O.Gadellaa@rn.rabobank.nl" href="mailto:K.O.Gadellaa@rn.rabobank.nl">
K.O.Gadellaa@rn.rabobank.nl</a> </div>
<div><b>Sent:</b> Friday, 07 September, 2012 18:24</div>
<div><b>To:</b> <a title="logback-user@qos.ch" href="mailto:logback-user@qos.ch">
logback-user@qos.ch</a> </div>
<div><b>Subject:</b> [logback-user] Modifying a logging events' level</div>
</div>
</div>
<div> </div>
</div>
<div style="DISPLAY: inline; FONT-WEIGHT: normal; FONT-SIZE: small; COLOR: #000000; FONT-STYLE: normal; FONT-FAMILY: 'Calibri'; TEXT-DECORATION: none">
<font face="Arial" size="2"><span style="FONT-SIZE: 10pt">
<div>Hi,</div>
<div> </div>
<div>I'm in the situation where a 3rd party code logs some content at a certain level, but I want that log to be a different (higher) level.</div>
<div>E.g: in my log: WARN : Connection to XYZ failed. </div>
<div>But I want: ERROR: Connection to XYZ failed.</div>
<div> </div>
<div>Is there a way to do this with logback?</div>
<div>(couldn't figure it out… maybe with a separate appender?)</div>
<div> </div>
<div>Regards,</div>
<div> </div>
<div>Koos Gadellaa</div>
<div> </div>
<div> </div>
<div> </div>
<div> </div>
</span></font>
<p>======================================================<br>
Rabobank disclaimer: http://www.rabobank.nl/disclaimer</p>
<p></p>
<hr>
_______________________________________________<br>
Logback-user mailing list<br>
Logback-user@qos.ch<br>
http://mailman.qos.ch/mailman/listinfo/logback-user</div>
</div>
</div>
<p>======================================================<br>
Rabobank disclaimer: http://www.rabobank.nl/disclaimer</p></body>
</html>