Uploaded image for project: 'SLF4J'
  1. SLF4J
  2. SLF4J-419

Make it possible to use a low priority LoggerFactory that is replaced in case a real slf4-implementation is available

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Core API
    • Labels:
      None

      Description

      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:

      Note that embedded components such as libraries or frameworks should not declare a dependency on any SLF4J binding but only depend on slf4j-api.

      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.

       

       

        Attachments

          Activity

            People

            • Assignee:
              slf4j-dev SLF4J developers list
              Reporter:
              loggerrr Jan S.
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: