[slf4j-dev] [JIRA] (SLF4J-419) Make it possible to use a low priority LoggerFactory that is replaced in case a real slf4-implementation is available

QOS.CH (JIRA) noreply-jira at qos.ch
Fri Nov 3 20:00:00 CET 2017


Jan S. created SLF4J-419:
----------------------------

             Summary: Make it possible to use a low priority LoggerFactory that is replaced in case a real slf4-implementation is available
                 Key: SLF4J-419
                 URL: https://jira.qos.ch/browse/SLF4J-419
             Project: SLF4J
          Issue Type: Improvement
          Components: Core API
            Reporter: Jan S.
            Assignee: SLF4J developers list


The current implementation of slf4j-api defaults to the NOP_FALLBACK_FACTORY. This behavior can not be changed which is a severe problem for library projects that also contain executable code:
{quote}Note that embedded components such as libraries or frameworks should not declare a dependency on any SLF4J binding but only depend on slf4j-api.
{quote}
because of this you can't link an slf4 implementation into it. Therefore code that gets executed from within that project uses the NOP_FALLBACK_FACTORY logger -> logging is disabled.

 

I understand why slf4j-api does not contain a standard logger to System.out or System.err. But why is the NOP_FALLBACK_FACTORY hard-coded? 

slf4j-api requires to have a possibility to define a LoggerFactory that is different to the default NOPLoggerFactory that will be used in case no other slf4j implementation is available.

 

There my request is to make it possible to define "a low priority LoggerFactory" that is replaced in case a real slf4-implementation is available. 

One possible way would be to allow modify LoggerFactory.NOP_FALLBACK_FACTORY directly or indirectly.

A second possibility would be to create some sort of marker (e.g. an Annotation) for an org.slf4j.impl.StaticLoggerBinder implementation that defines "this implementation should only be used if no other implementation can be found.

 

 



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


More information about the slf4j-dev mailing list