[slf4j-dev] [Bug 210] New: Illegal Access to SINGLETON field

bugzilla-daemon at pixie.qos.ch bugzilla-daemon at pixie.qos.ch
Mon Dec 13 17:31:58 CET 2010


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

           Summary: Illegal Access to SINGLETON field
           Product: SLF4J
           Version: 1.6.x
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: blocker
          Priority: P1
         Component: log4j-over-slf4j
        AssignedTo: slf4j-dev at qos.ch
        ReportedBy: dsills at datasourceinc.com


While running a JUnit test using SLF4J 1.6.1 under Java 1.4.2, I was unable to
proceed because the lines 49-53 of the StaticLoggerBinder in the
log4j-over-slf4j JAR file (well, the source for that class) read:

  /**
   * The unique instance of this class.
   * 
   */
  private static final StaticLoggerBinder SINGLETON = new StaticLoggerBinder();

The private variable was somehow involved in what the LoggerFactory was doing.
Following a suggestion on the web, I replaced this line with:

  /**
   * The unique instance of this class.
   * 
   */
  public static final StaticLoggerBinder SINGLETON = new StaticLoggerBinder();

and everything works great.

It may be that there's a reason to keep the SINGLETON private, but one cannot
use the logger in that case, as the JVM at runtime throws an
IllegalAccessException. However, it seems (though I can find no specific reason
why this might be the case) that the LoggerFactory must itself be recompiled in
conjunction with this change in order to work.

It may be that SLF4J 1.6.1 shouldn't run under 1.4.2 (though I see nothing that
forbids it), but if it should, this one-line change would make, I would think,
a significant difference.


-- 
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