본문 바로가기

개발/Java

slf4j와 log4j2 연동시 Unexpected problem occured during version sanity check 에러발생

728x90
반응형

slf4j와 log4j2 연동시 Unexpected problem occured during version sanity check 에러발생

Unexpected problem occured during version sanity check
Reported exception:
java.lang.AbstractMethodError: Receiver class org.apache.logging.slf4j.SLF4JServiceProvider does not define or inherit an implementation of the resolved method abstract getRequestedApiVersion()Ljava/lang/String; of interface org.slf4j.spi.SLF4JServiceProvider.
	at org.slf4j.LoggerFactory.versionSanityCheck(LoggerFactory.java:298)
	at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:141)
	at org.slf4j.LoggerFactory.getProvider(LoggerFactory.java:422)
	at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:408)
	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:357)
	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:383)
	at com.github.devcode.cmd.CmdAppMain.<clinit>(CmdAppMain.java:15)

[slf4j / log4j2] java.lang.AbstractMethodError

 

에러가 발생하는 라이브러리 조합

확인결과, 라이브러리 log4j-slf4j-impl-2.x 와 slf4j-api-2.x 를 같이 사용하면 에러가 발생하는 것으로 확인되었다. 

또 안되는 조건은 log4j-to-slf4j-2.x.jar, log4j-slf4j-impl-2.x.jar 라이브러리를 같이 사용하면 안된다.(https://logging.apache.org/log4j/2.x/runtime-dependencies.html)

해결방법

log4j 2.x(2.1.19)를 사용하고 slf4j-api를 1.x(1.7.36)으로 설정하여 해결하였다.

slf4j / log4j2 연동시 참고

https://logging.apache.org/log4j/2.x/log4j-slf4j-impl/index.html

 

SLF4J Binding Using Log4j – Log4j 2 SLF4J Binding

<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apa

logging.apache.org

 

728x90
반응형