As long as there is a close all somewhere, I think this sounds great...  

How do we propose this?  Sounds like this is actually a SLF4J request?  Is anyone interested in this thread a commiter for SLF4J?  Do you know if feature requests like this are supposed to go in the bug tracking system?  Do you want me to open a request?

Mike

On Thu, Sep 30, 2010 at 11:36 AM, Chris <shef31@yahoo.com> wrote:
No reason you can't do both. Close an individual logger when you need to, close them all when you need to.


On 9/29/2010 11:30 AM, Michael Schall wrote:
Are you suggesting a close method on ILogger?  We use a static logger
per class.  I don't want to have to close each logger separately.  I
would like a master shutoff switch that will synchronously flush all
appenders so I can call it before exiting my app.  The ILoggerFactory
seems like the perfect spot for this.

On Wed, Sep 29, 2010 at 10:42 AM, Chris
<shef31@yahoo.com
<mailto:shef31@yahoo.com>> wrote:

   I think the right solution is to add a logger.close() method to
   slf4j. Each implementation could handle it in its own way. For
   logback or log4j, it would just call stop() on each of the appenders
   that were attached to the logger.




   On 9/29/2010 10:23 AM, Michael Schall wrote:

       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.

       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.

       I'm trying to achieve writing code only using SLF4J and...

       if slf4j-log4j12-1.6.1.jar and log4j-1.2.15.jar are in my production
       classpath, I'm logging using log4j.
       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.

       So without changing code, I can switch between logging back ends.

       Should ILoggerFactory have a shutdown or stop method?  It could
       shutdown
       whatever logging back end I'm using?

       For log4j it would call
       - org.apache.log4j.LogManager.getLoggerRepository().shutdown();
       For logback it would call - loggerContext.stop()

       Thoughts?
       Mike

       On Tue, Sep 28, 2010 at 4:02 PM, Robert Elliot
       <rob@lidalia.org.uk
       <mailto:rob@lidalia.org.uk>
       <mailto:rob@lidalia.org.uk
       <mailto:rob@lidalia.org.uk>>> wrote:

           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.

           (You can cast the result of
       LoggerFactory.getILoggerFactory() to a
           LoggerContext).

           On 28 Sep 2010, at 21:53, Michael Schall wrote:

               Great question!  I asked this on stackoverflow a while
           back with no
               real answers...

           http://stackoverflow.com/questions/3678755/do-i-need-to-flush-events-when-shutting-down-using-logback

               On Tue, Sep 28, 2010 at 3:32 PM, Chris
           <shef31@yahoo.com
           <mailto:shef31@yahoo.com>
           <mailto:shef31@yahoo.com

           <mailto:shef31@yahoo.com>>> wrote:

                   I'm using file appenders. At a certain point in my
               app, a little
                   before
                   shutdown, I have to close all loggers.

                   How do I tell logback to call stop() on all appenders?

                   _______________________________________________
                   Logback-user mailing list
               Logback-user@qos.ch
               <mailto:Logback-user@qos.ch>
               <mailto:Logback-user@qos.ch
               <mailto:Logback-user@qos.ch>>

               http://qos.ch/mailman/listinfo/logback-user

               _______________________________________________
               Logback-user mailing list
           Logback-user@qos.ch
           <mailto:Logback-user@qos.ch>
           <mailto:Logback-user@qos.ch
           <mailto:Logback-user@qos.ch>>

           http://qos.ch/mailman/listinfo/logback-user



           _______________________________________________
           Logback-user mailing list
       Logback-user@qos.ch
       <mailto:Logback-user@qos.ch>
       <mailto:Logback-user@qos.ch
       <mailto:Logback-user@qos.ch>>

       http://qos.ch/mailman/listinfo/logback-user




       _______________________________________________
       Logback-user mailing list
       Logback-user@qos.ch
       <mailto:Logback-user@qos.ch>
       http://qos.ch/mailman/listinfo/logback-user



   _______________________________________________
   Logback-user mailing list
   Logback-user@qos.ch <mailto:Logback-user@qos.ch>
   http://qos.ch/mailman/listinfo/logback-user




_______________________________________________
Logback-user mailing list
Logback-user@qos.ch
http://qos.ch/mailman/listinfo/logback-user


_______________________________________________
Logback-user mailing list
Logback-user@qos.ch
http://qos.ch/mailman/listinfo/logback-user