Hi <font color="#888888">Ceki Gülcü,<br><br>Thanks for your fast reply. <br>So the problem is that I'm not using the Logback but the Log4j 1.3 alpha 8 version that also has<br>JoranConfigurator object. (author: </font>Curt Arnold, <a href="http://www.qos.ch/log4j/">Ceki Gülcü</a>)<br>
I thought I ask you since you've written it and you more likely to reply to my message from this forum.<br>I'm looking at the (Log4j 1.3 alpha 8) API and don't see any LoggerContext object there. <br>I have at the moment this in my class:<br>
<br>public someConstructor(String className, String propertyFile) {<br> <br> //Reads the configuration file.<br> if (!configFile.endsWith("xml") || configFile == ""){<br> throw new InvalidParameterException("Invalid XML property file.");<br>
}<br> <br> logger = org.apache.log4j.Logger.getLogger(className);<br> JoranConfigurator jc = new JoranConfigurator();<br> jc.doConfigure(configFile, LogManager.getLoggerRepository());<br>
}<br><font color="#888888"><br>This will always work even if I pass in my config file <br><blah blah blah/><br>Nothing will happen, that is, no exception and no log will be printed. (written etc.) <br>Any other suggestions?<br>
I know this isn't the log4j forum..... <br>Thanks<br>Gregory.<br><br><br><br>There's no such thing as LoggerContext or a method<br></font><br><div class="gmail_quote">On Wed, Mar 18, 2009 at 1:44 PM, Ceki Gulcu <span dir="ltr"><ceki@qos.ch></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
Hello Greg,<br>
<br>
In the documentation relative to auto configuration [1], one can read:<br>
<br>
If the configuration file is found but is ill-formed, then logback<br>
will detect the error condition and automatically print its internal<br>
status on the console.<br>
<br>
So either the documentation is wrong or logback cannot find your<br>
configuration file. In any case, you can instruct logback to print its<br>
internal status data with the following code:<br>
<br>
LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();<br>
StatusPrinter.print(lc);<br>
<br>
See [2] for a full example.<br>
<br>
HTH<br>
<br>
[1] <a href="http://logback.qos.ch/manual/configuration.html#auto_configuration" target="_blank">http://logback.qos.ch/manual/configuration.html#auto_configuration</a><br>
[2] <a href="http://logback.qos.ch/xref/chapter3/MyApp2.html" target="_blank">http://logback.qos.ch/xref/chapter3/MyApp2.html</a><div><div></div><div class="h5"><br>
<br>
<br>
Greg Flex wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi All,<br>
I was wondering if there is an easy way to test the validity of an XML configuration file.<br>
Just as an example I have this now in the config file <blah blah blah><br>
JoranConfigurator doConfigure accepts it and no exception is thrown.<br>
Nothing gets printed or written to a file etc. however I'd like to detect that the config file is messed up.<br>
Any suggestions?<br>
Thanks<br>
</blockquote>
<br></div></div><font color="#888888">
-- <br>
Ceki Gülcü<br>
Logback: The reliable, generic, fast and flexible logging framework for Java.<br>
<a href="http://logback.qos.ch" target="_blank">http://logback.qos.ch</a><br>
_______________________________________________<br>
Logback-user mailing list<br>
Logback-user@qos.ch<br>
<a href="http://qos.ch/mailman/listinfo/logback-user" target="_blank">http://qos.ch/mailman/listinfo/logback-user</a><br>
</font></blockquote></div><br>