[ 
https://issues.apache.org/jira/browse/LOG4J2-3257?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17462311#comment-17462311
 ] 

Ralph Goers commented on LOG4J2-3257:
-------------------------------------

Yeah, your exception is telling you that the put(String key, String value) 
method is not there. Except it is. The only way that could happen is if 
org.apache.logging.MDC is also in another jar on the classpath. Log4j 1.x did 
not have the method that accepted a String value.

> MDC class in 2.17.0 has multiple "put" methods
> ----------------------------------------------
>
>                 Key: LOG4J2-3257
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3257
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: log4j 1.2 emulation
>    Affects Versions: 2.17.0
>            Reporter: Mike
>            Priority: Major
>
> We use MDC.put for a variety of things.  With the 2.17 version, it appears 
> there is a bug.
> When including the jar from maven, we can see the following:
>  
> {code:java}
> private MDC() {
> }
> public static void put(final String key, final String value) {
>     localMap.get().put(key, value);
>     ThreadContext.put(key, value);
> }
> public static void put(final String key, final Object value) {
>     localMap.get().put(key, value);
>     ThreadContext.put(key, value.toString());
> } {code}
> Java is very unhappy when trying to call this, and causes problems in our 
> application.
> The error we are getting is:
> {code:java}
> SEVERE: Servlet.service() for servlet [default] in context with path [] threw 
> exception [Filter execution threw an exception] with root cause
> java.lang.NoSuchMethodError: 
> org.apache.log4j.MDC.put(Ljava/lang/String;Ljava/lang/String;)V {code}
> I have reverted back to 2.16.0 for the time being and we aren't having 
> problems.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to