SLF4J: Detected both log4j-over-slf4j.jar AND bound slf4j-log4j12.jar on the class path, preempting StackOverflowError

위와 같은 이슈가 발생했다.

다른 프로젝트를 gradle compile 로 가지고 오는데 다른프로젝트의 내부에서 slf4j-log4j12 라이르러리를 가지고 있어서 , springboot에서 빌드 할때 bridge가 log4j12-over-slf4j 로 되어있고, binding이 slf4j-log4j12 로 가지게 되면 계속 무한 반복이 일어나기 때문에 아래와 같은 에러를 발생시키는것이다.

아래 세부 로그를 보면 binding 할때 두개의 라이브러리를 찾았다. logback 과 slf4j-log4j12 이다 .

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/KDY/.gradle/caches/modules-2/files-2.1/ch.qos.logback/logback-classic/1.2.3/7c4f3c474fb2c041d8028740440937705ebb473a/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/KDY/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-log4j12/1.7.16/54c6dd23a7c420e40b8848e962d5f2a3534260af/slf4j-log4j12-1.7.16.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.

import 하는 프로젝트의 gradle 설정에서 아래와 같이 slf4j-log4j12 바인딩의 라이브러리를 제외 시켜 줌 으로써 해결

configurations.all{
    exclude group: 'org.slf4j', module: 'slf4j-log4j12'
}

스프링 부트 관련 Bridge, Binding 에 대한 설명은 아래의 포스트에 설명이 되어있다.
https://deviscreen.tistory.com/118

'BackEnd > SpringBoot' 카테고리의 다른 글

[SpringBoot]Validation 에러 처리하기  (0) 2021.08.22
Spring Boot Logging (1)  (0) 2020.04.16
Request Body 의 값 BadRequest 로 보내기  (0) 2020.04.11
SpringBoot(4) -T-Academy  (0) 2019.05.24
SpringBoot(3)-T-Academy  (0) 2019.05.22

+ Recent posts