[slf4j-dev] [JIRA] (SLF4J-423) 1.8.0-beta0 bug in log4j MDC handling

QOS.CH (JIRA) noreply-jira at qos.ch
Mon Dec 4 16:46:00 CET 2017


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

Ralph Goers commented on SLF4J-423:
-----------------------------------

If you are routing SLF4J to Log4j 2 you should not need the slf4j-log4j12 jar. You can use log4j-slf4j-impl to route slf4j directly to Log4j 2 and then log4j-1.2-api to route log4j api calls to Log4j 2.

> 1.8.0-beta0 bug in log4j MDC handling
> -------------------------------------
>
>                 Key: SLF4J-423
>                 URL: https://jira.qos.ch/browse/SLF4J-423
>             Project: SLF4J
>          Issue Type: Bug
>          Components: Unspecified
>    Affects Versions: 1.8.0-beta0
>         Environment: Java 9
>            Reporter: Brett Wooldridge
>            Assignee: SLF4J developers list
>
> When running with log4j 2.10.0, and using the slf4j-log4j12-1.8.0-beta0 release, the follow error is received:
> {code:java}
> java.lang.NoSuchFieldException: mdc
>  at java.base/java.lang.Class.getDeclaredField(Unknown Source)
>  at org.apache.log4j.MDCFriend.fixForJava9(MDCFriend.java:13)
>  at org.slf4j.log4j12.Log4jMDCAdapter.<clinit>(Log4jMDCAdapter.java:38)
>  at org.slf4j.log4j12.Log4j12ServiceProvider.initialize(Log4j12ServiceProvider.java:37)
>  at org.slf4j.LoggerFactory.bind(LoggerFactory.java:153)
>  at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:141)
>  at org.slf4j.LoggerFactory.getProvider(LoggerFactory.java:413)
>  at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:405)
>  at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:354)
>  at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:380){code}
> The MDC class in log4j-1.2-api-2.10.0.jar no longer contains a field named "mdc".  (This is on Java 9).
>  



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


More information about the slf4j-dev mailing list