This requires me to have access to ch.qos.logback.classic when writing code. It does not allow me to switch loggers out without changing code. <div><br></div><div>We are in the process of moving from log4j to logback. One requirement placed on me is to be able to revert back to log4j if something "goes wrong". I was hoping that using SLF4J would give me this ability. <div>
<br></div><div>I'm trying to achieve writing code only using SLF4J and...</div><div><br></div><div>if slf4j-log4j12-1.6.1.jar and log4j-1.2.15.jar are in my production classpath, I'm logging using log4j. </div><div>
If log4j-over-slf4j-1.6.1.jar (for third-party logging), logback-classic-0.9.24.jar, and logback-core-0.9.24.jar are in my production classpath, I'm logging using logback.<div><br></div><div>So without changing code, I can switch between logging back ends.<br>
<div><br></div><div>Should ILoggerFactory have a shutdown or stop method? It could shutdown whatever logging back end I'm using?</div><div><br></div><div>For log4j it would call - org.apache.log4j.LogManager.getLoggerRepository().shutdown();</div>
<div>For logback it would call - <span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">loggerContext.stop()</span></div><div><br></div><div>Thoughts?<br><div>Mike</div>
<div><br><div class="gmail_quote">On Tue, Sep 28, 2010 at 4:02 PM, Robert Elliot <span dir="ltr"><<a href="mailto:rob@lidalia.org.uk">rob@lidalia.org.uk</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">How about LoggerContext.stop()? It looks as if it's designed specifically for this purpose. It recursively stops and detaches all appenders, amongst other things.<div><br></div><div>
(You can cast the result of <span style="font-family:Monaco;font-size:11px">LoggerFactory.getILoggerFactory() to a LoggerContext).</span></div><div><div></div><div class="h5"><div><font face="Monaco" size="3"><span style="font-size:11px"><br>
</span></font><div><div>On 28 Sep 2010, at 21:53, Michael Schall wrote:</div><br><blockquote type="cite"><div>Great question! I asked this on stackoverflow a while back with no<br>real answers...<br><br><a href="http://stackoverflow.com/questions/3678755/do-i-need-to-flush-events-when-shutting-down-using-logback" target="_blank">http://stackoverflow.com/questions/3678755/do-i-need-to-flush-events-when-shutting-down-using-logback</a><br>
<br>On Tue, Sep 28, 2010 at 3:32 PM, Chris <<a href="mailto:shef31@yahoo.com" target="_blank">shef31@yahoo.com</a>> wrote:<br><blockquote type="cite">I'm using file appenders. At a certain point in my app, a little before<br>
</blockquote><blockquote type="cite">shutdown, I have to close all loggers.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">How do I tell logback to call stop() on all appenders?<br></blockquote>
<blockquote type="cite"><br></blockquote><blockquote type="cite">_______________________________________________<br></blockquote><blockquote type="cite">Logback-user mailing list<br></blockquote><blockquote type="cite"><a href="mailto:Logback-user@qos.ch" target="_blank">Logback-user@qos.ch</a><br>
</blockquote><blockquote type="cite"><a href="http://qos.ch/mailman/listinfo/logback-user" target="_blank">http://qos.ch/mailman/listinfo/logback-user</a><br></blockquote><blockquote type="cite"><br></blockquote>_______________________________________________<br>
Logback-user mailing list<br><a href="mailto:Logback-user@qos.ch" target="_blank">Logback-user@qos.ch</a><br><a href="http://qos.ch/mailman/listinfo/logback-user" target="_blank">http://qos.ch/mailman/listinfo/logback-user</a><br>
</div></blockquote></div><br></div></div></div></div><br>_______________________________________________<br>
Logback-user mailing list<br>
<a href="mailto:Logback-user@qos.ch">Logback-user@qos.ch</a><br>
<a href="http://qos.ch/mailman/listinfo/logback-user" target="_blank">http://qos.ch/mailman/listinfo/logback-user</a><br>
<br></blockquote></div><br></div></div></div></div></div>