[slf4j-dev] [Bug 106] New: Obtaining a logger before loggerFactory is assigned

bugzilla-daemon at pixie.qos.ch bugzilla-daemon at pixie.qos.ch
Wed Oct 15 23:50:42 CEST 2008


http://bugzilla.slf4j.org/show_bug.cgi?id=106

           Summary: Obtaining a logger before loggerFactory is assigned
           Product: SLF4J
           Version: 1.5.x
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: blocker
          Priority: P1
         Component: Core API
        AssignedTo: dev at slf4j.org
        ReportedBy: listid at qos.ch


This issue was first identified in http://jira.qos.ch/browse/LBCORE-47
While it is reported in the logback project, it is also an SLF4J issue.

The problem can be described as follows:

1) In the static initializer of the LoggerFactory class, the result of
StaticLoggerBinder.SINGLETON.getLoggerFactory() is assigned to the
loggerFactory variable

2) the StaticLoggerBinder.SINGLETON.getLoggerFactory() call,
instantiates a logback LoggerContext which proceeds with
auto-initialization.

3) auto-initialization reads the config file which creates a some component X

4) component X class performs logging via commons-logging, using the
jcl-over-slf4j implementation. However, at this stage the loggerFactory
variable is not yet assigned. Hence the error.

Solution: Set loggerFactory variable to NOPLoggerFactory before the line
loggerFactory = StaticLoggerBinder.SINGLETON.getLoggerFactory()


-- 
Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the slf4j-dev mailing list