There are a couple ways:<div><br></div><div>1) Use <a href="http://logback.qos.ch/apidocs/ch/qos/logback/core/util/StatusPrinter.html#printInCaseOfErrorsOrWarnings(ch.qos.logback.core.Context)">StatusPrinter.printInCaseOfErrorsOrWarnings(loggerContext)</a></div>
<div><br></div><div>OR</div><div><br></div><div>2) Load hard-coded string of configuration XML w/configuration.debug set to 'true':</div><div><br></div><div><div><span class="Apple-tab-span" style="white-space:pre"> </span>static final String LOGBACK_XML = </div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>"<configuration debug='true'>" + </div><div><span class="Apple-tab-span" style="white-space:pre"> </span>" <appender name='FILE' class='ch.qos.logback.core.RollingFileAppender'>" +</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>" <file>foo.log</file>" +</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>" <append>true</append>" +</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>" <encoder>" +</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>" <pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</pattern>" +</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>" </encoder>" +</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>" </appender>" +</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>" <root level='INFO'>" +</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>" <appender-ref ref='FILE' />" +</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>" </root>" +</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>"</configuration>"</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span></div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>static public void configLogback() {</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();</div>
<div> try {</div><div> JoranConfigurator configurator = new JoranConfigurator();</div><div> configurator.setContext(lc);</div><div> lc.reset();</div><div> </div>
<div> configurator.doConfigure(new ByteArrayInputStream(LOGBACK_XML.getBytes()));</div><div> } catch (JoranException je) {</div><div> je.printStackTrace(<span class="s1">);</span></div>
<div> }</div><div><br></div><div> // you can also print the errors/warning explicitly (instead of debug='true' in xml)</div><div> //StatusPrinter.printInCaseOfErrorsOrWarnings(lc);</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>}</div></div><div><br><br><div class="gmail_quote">On Tue, Dec 13, 2011 at 6:20 PM, Jack Vinijtrongjit <span dir="ltr"><<a href="mailto:juminoz@hotmail.com">juminoz@hotmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div dir="ltr">
I ended up accessing BasicStatusManager directly to get the message out so I can at least see what's going on. Then I was able to figure out that some required configuration wasn't set for RollingPolicy object.<div>
<br></div><div>Please let me know if there is a way to make BasicStatusManager cough up all log messages for LogBack. Otherwise, I guess I just have to do it the way I'm doing now when things are not working.<br><div>
<br></div><div>Thanks,</div><div>Jack</div><div><br></div><div><div class="hm HOEnZb"><br></div></div></div></div></div></blockquote></div><br></div>