-
[Spring boot] Class path contains multiple SLF4J bindings 에러Server/Spring Boots 2020. 10. 21. 13:44
참조
www.baeldung.com/slf4j-classpath-multiple-bindings
SLF4J Warning: Class Path Contains Multiple SLF4J Bindings | Baeldung
Learn about the SLF4J warning "Class path contains multiple SLF4J bindings" and how to fix it
www.baeldung.com
에러 로그
SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:.../slf4j-log4j12-1.7.21.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:.../logback-classic-1.1.7.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
에러 로그에 따르면 SLF4J가 Multiple Binding이 되어 있다고 나온다.
충돌나는부분은 log4J와 logback이다.
우선 Spring-boot-starter-web 패키지에는 Spring-boot-starter-logging을 dependency로 참조하고 있다. 만약 여기서 Spring-boot-starter-log4j2 를 pom.xml에 추가해 넣게 되면 충돌이 일어나게 되는 것이다.
stackoverflow.com/questions/14024756/slf4j-class-path-contains-multiple-slf4j-bindings
SLF4J: Class path contains multiple SLF4J bindings
I'm getting the following error. It seems there are multiple logging frameworks bound to slf4j. Not sure how to resolve this. Any help is greatly appreciated. SLF4J: Class path contains multiple SL...
stackoverflow.com
머 해결방법은 다양하다. Multiple Binding이 되는 부분을 지워주면 된다. 나 같은 경우는 spring-boot-starter-log4j2를 사용하기 위해서 spring-boot-starter-logging을 exclude 했다. 반대로 log4j2를 주석처리해서 dependency에서 빼도 동작한다.
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <exclusions> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-logging</artifactId> </exclusion> </exclusions> </dependency>
'Server > Spring Boots' 카테고리의 다른 글
Apache James + AWS EC2 메일 서버 구축 (1) 2021.06.30 Spring Security + CustomAuthenticationFilter 만들기 (0) 2021.05.27 Spring Boot Maven Multi Module 개발환경 설정하기 (0) 2020.11.11 Spring Profile + Maven Profile + WAR파일 배포 (1) 2020.10.21