Getting Exception org.apache.logging.slf4j.SLF4JLoggerContext cannot be cast to org.apache.logging.log4j.core.LoggerContext

后端 未结 2 976
不思量自难忘°
不思量自难忘° 2020-12-05 18:06

My code is very simple using apache-log4j-2.0.2:

import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Logger;

public class Log4jtest {
  stati         


        
2条回答
  •  南方客
    南方客 (楼主)
    2020-12-05 18:17

    Remove below jar's from class path and it should fix the issue -

    log4j-to-slf4j-2.0.2.jar
    log4j-to-slf4j-2.0.2-sources.jar
    log4j-slf4j-impl-2.0.2.jar
    log4j-slf4j-impl-2.0.2-sources.jar
    

    I was able to replicate and fix the issue after downloading apache-log4j-2.0.2 from http://www.apache.org/dyn/closer.cgi/logging/log4j/2.0.2/apache-log4j-2.0.2-bin.zip.

提交回复
热议问题