[slf4j-dev] [JIRA] (SLF4J-192) Need ability to shutdown loggers and flush appenders

QOS.CH (JIRA) noreply-jira at qos.ch
Wed Jan 2 15:37:00 CET 2019


    [ https://jira.qos.ch/browse/SLF4J-192?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=19387#comment-19387 ] 

Andrea Santi commented on SLF4J-192:
------------------------------------

I understand that SL4J general idea is about having a simple facede library. It is true that I have a file configuring the real logging framework used behind SLF4J (log4j2 in my case) and the related backend dependency (this is inevitable). However, this is the only touching point to the underlying logging framework: all the rest is managed by SLF4J. This is not bad and totally in accordance with the idea of the facade: with the effort of a little setup the extra-complexity of the underlying logging framework is hidden. It's like having a wall separating the two worlds.

I really would love things to remain like that!

Having a "shutdown" method in the SLF4J interface is not going to change the nature of the facade: most of the logging framework have this feature and it is trivial to implement a sort of "nop" method for logging frameworks not having this functionality.

"*If I am building a code dependency on the underlying logger, why even use SLF4J?"* --> I intended this sentence that I quoted *not* as _"I have an additional dependency in my project"_ but something like _"If I have to write in my class some framework-specific code then I can just get rid of SLF4J and use directly the specific logging framework"_. The idea of using SLF4J should be that I don't rely on framework-specific code right?

These are just my two cents...

 

> Need ability to shutdown loggers and flush appenders
> ----------------------------------------------------
>
>                 Key: SLF4J-192
>                 URL: https://jira.qos.ch/browse/SLF4J-192
>             Project: SLF4J
>          Issue Type: Improvement
>          Components: Core API
>    Affects Versions: 1.6.x
>         Environment: Operating System: All
> Platform: All
>            Reporter: Michael Schall
>            Assignee: SLF4J developers list
>
> There needs to be a way to shutdown logging and flush async appenders so when a process is closing, all log events are written before the process is closed.
> 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()
> Other back ends - ???
> This is required to allow me to not reference logging back ends explicitly in my code to shutdown successfully without losing events.
> Discussion about this is happening on the user list at -
> http://www.qos.ch/pipermail/logback-user/2010-September/001816.html



--
This message was sent by Atlassian JIRA
(v7.3.1#73012)


More information about the slf4j-dev mailing list