<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 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
        {mso-style-priority:99;
        mso-style-link:"Plain Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.5pt;
        font-family:Consolas;}
span.PlainTextChar
        {mso-style-name:"Plain Text Char";
        mso-style-priority:99;
        mso-style-link:"Plain Text";
        font-family:Consolas;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</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>

<div class=Section1>

<p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'>There
are some additional features &amp; design patterns that might help you out, but
it's hard to go too far into them when we don’t know your use case.<o:p></o:p></span></p>

<p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'>In
particular, why don’t you want to use a file for your configuration? What situation
requires that you modify the logging levels from inside your code? This isn’t
really a great thing to do: much of the usefulness of logging systems is the
ability to change the configuration without rewriting the application.<o:p></o:p></span></p>

<p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'>Without
more information, I’d suggest you look at the <a
href="http://logback.qos.ch/jmxConfig.html">JMX configuration</a> system and
writing <a href="http://logback.qos.ch/manual/filters.html">filters</a>. These
features help make a file-based configuration less static than it seems.<o:p></o:p></span></p>

<p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'>Thanks,<o:p></o:p></span></p>

<p class=MsoPlainText><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'> <i>Andy<o:p></o:p></i></span></p>

<p class=MsoPlainText><o:p>&nbsp;</o:p></p>

<p class=MsoPlainText>-----Original Message-----<br>
From: logback-user-bounces@qos.ch [mailto:logback-user-bounces@qos.ch] On
Behalf Of Ceki Gulcu<br>
Sent: Monday, April 07, 2008 10:51 AM<br>
To: logback users list<br>
Subject: Re: [logback-user] have to cast logger to use logback specific api<o:p></o:p></p>

<p class=MsoPlainText><o:p>&nbsp;</o:p></p>

<p class=MsoPlainText><o:p>&nbsp;</o:p></p>

<p class=MsoPlainText>Is the HelloWorld1 example you refer to, the one shown at
[1]?<o:p></o:p></p>

<p class=MsoPlainText><o:p>&nbsp;</o:p></p>

<p class=MsoPlainText>Anyway,  while it is true that you cannot set the logger
level without casting <o:p></o:p></p>

<p class=MsoPlainText>to logback's native API, you can configure logback using
a configuration script. <o:p></o:p></p>

<p class=MsoPlainText>Moreover, logback will automatically search for a
configuration script called <o:p></o:p></p>

<p class=MsoPlainText>logback.xml (or logback-test.xml) in your class path.<o:p></o:p></p>

<p class=MsoPlainText><o:p>&nbsp;</o:p></p>

<p class=MsoPlainText>Thus, in your Java code you can only reference the SLF4J
API and configure the <o:p></o:p></p>

<p class=MsoPlainText>underlying logging system, namely logback, using an
automatically loaded <o:p></o:p></p>

<p class=MsoPlainText>configuration script.<o:p></o:p></p>

<p class=MsoPlainText><o:p>&nbsp;</o:p></p>

<p class=MsoPlainText>For more detailed information please see [2].<o:p></o:p></p>

<p class=MsoPlainText><o:p>&nbsp;</o:p></p>

<p class=MsoPlainText>I hope this helps,<o:p></o:p></p>

<p class=MsoPlainText><o:p>&nbsp;</o:p></p>

<p class=MsoPlainText>[1] http://logback.qos.ch/xref/index.html<o:p></o:p></p>

<p class=MsoPlainText>[2] http://logback.qos.ch/manual/joran.html<o:p></o:p></p>

<p class=MsoPlainText><o:p>&nbsp;</o:p></p>

<p class=MsoPlainText>dvd@newfoundmarket.com wrote:<o:p></o:p></p>

<p class=MsoPlainText>&gt; Hello:<o:p></o:p></p>

<p class=MsoPlainText>&gt; <o:p></o:p></p>

<p class=MsoPlainText>&gt; I tried the Helloword1 example that comes with
logback and noticed that <o:p></o:p></p>

<p class=MsoPlainText>&gt; slf4j's Logger does not have methods such as
logger.setLevel that <o:p></o:p></p>

<p class=MsoPlainText>&gt; logback provides, in order to use it, I have to cast
it to logback's <o:p></o:p></p>

<p class=MsoPlainText>&gt; Logger.  I'd need to use those methods in app on the
fly instead of use <o:p></o:p></p>

<p class=MsoPlainText>&gt; a static config file.  But once I cast it, it means
it would be tied to <o:p></o:p></p>

<p class=MsoPlainText>&gt; logback and why bother with the slf4j at all? I mean
once I do this way, <o:p></o:p></p>

<p class=MsoPlainText>&gt; I can not do the deployment time switch to other
logging lib.<o:p></o:p></p>

<p class=MsoPlainText>&gt; <o:p></o:p></p>

<p class=MsoPlainText>&gt; What would be the recommended way to deal with my
scenarios?<o:p></o:p></p>

<p class=MsoPlainText>&gt; <o:p></o:p></p>

<p class=MsoPlainText>&gt; Thanks<o:p></o:p></p>

<p class=MsoPlainText><o:p>&nbsp;</o:p></p>

<p class=MsoPlainText>-- <o:p></o:p></p>

<p class=MsoPlainText>Ceki Gülcü<o:p></o:p></p>

<p class=MsoPlainText>QOS.ch is looking to hire talented developers in
Switzerland.  If<o:p></o:p></p>

<p class=MsoPlainText>interested, please contact c e k i @ q o s . c h<o:p></o:p></p>

<p class=MsoPlainText><o:p>&nbsp;</o:p></p>

<p class=MsoPlainText>_______________________________________________<o:p></o:p></p>

<p class=MsoPlainText>Logback-user mailing list<o:p></o:p></p>

<p class=MsoPlainText>Logback-user@qos.ch<o:p></o:p></p>

<p class=MsoPlainText>http://qos.ch/mailman/listinfo/logback-user<o:p></o:p></p>

</div>

<pre>***************************************************************************
The information contained in this communication is confidential, is
intended only for the use of the recipient named above, and may be legally
privileged.

If the reader of this message is not the intended recipient, you are
hereby notified that any dissemination, distribution or copying of this
communication is strictly prohibited.

If you have received this communication in error, please resend this
communication to the sender and delete the original message or any copy
of it from your computer system.

Thank You.
****************************************************************************
</pre></body>

</html>