[slf4j-dev] [JIRA] (SLF4J-201) Illegal Access to SINGLETON field

QOS.CH (JIRA) noreply-jira at qos.ch
Mon May 13 09:37:00 CEST 2019


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

Aaron Digulla commented on SLF4J-201:
-------------------------------------

Does slf4j still support Java 1.4? If not, this issue can be closed.

> Illegal Access to SINGLETON field
> ---------------------------------
>
>                 Key: SLF4J-201
>                 URL: https://jira.qos.ch/browse/SLF4J-201
>             Project: SLF4J
>          Issue Type: Bug
>          Components: log4j-over-slf4j
>    Affects Versions: 1.6.x
>         Environment: Operating System: Windows XP
> Platform: PC
>            Reporter: David Sills
>            Assignee: SLF4J developers list
>
> 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.



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


More information about the slf4j-dev mailing list