본문 바로가기

카테고리 없음

[logback] logback 1.2 -> 1.4 업그레이드를 하며 발생된 오류들

728x90

목표 : Logback 1.2.11 -> 1.4 버전 업그레이드 (현) logback-classic, core:1.2.11, logstash-logback-encoder:6.4)

 

시도 1. 무지성 업그레이드

 

실패 : StaticLoggerBinder 클래스를 로드할 수 없다는 로그

 

logback 1.3 버전 이상부터는 slf4j-api 2버전 이상을 타겟팅하며 StaticLoggerBinder를 더이상 제공하지 않는다. 

Note that slf4j-api versions 2.0.x and later use the ServiceLoader mechanism. Backends such as logback 1.3 and later which target slf4j-api 2.x, do not ship with org.slf4j.impl.StaticLoggerBinder. If you place a logging backend which targets slf4j-api 2.0.x, you need slf4j-api-2.x.jar on the classpath. See also relevant faq entry.

SINCE 1.6.0 As of SLF4J version 1.6, in the absence of a binding, SLF4J will default to a no-operation (NOP) logger implementation.

 

확인해보니 slf4j-api 1.7 버전을 사용하길래 이거와 호환성 문제인가 싶었다

 

생김새만 다를 뿐 똑같은 오류

 

 

 

 

 

 

결론: 불가능

 

NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder (with SLF4J, Logback and Spring Boot)

Since of nowhere I getting the error message that the class StaticLoggerBinder was not found. I guess it have something to do with the Spring-Boot API. Any solutions to the problem? pom.xml: ...

stackoverflow.com

Spring Boot 2.5.5 depends on logback 1.2.x and SLF4J 1.x.

SLF4J implementation significantly changed between 1.x and 2.x (and as a consequence logback 1.2.x vs. 1.3.x/1.4.x) so that some usages are not compatible anymore. Typically usage of StaticLoggerBinder is not possible anymore.

The 1st version of Spring Boot compatible with SLF4J 2.x and logback 1.3.x/1.4.x is the 3.0.0.

You need to either stay with logback 1.2.x and SLF4J 1.x, or also upgrade Spring Boot to 3.x. I would recommend the latter obviously.

 

 

 

참고사이트

https://livenow14.tistory.com/64

 

[Logging] Logback이란?

블로그를 작성하고, 테코톡을 진행했어요. 더 쉽게 이해하고 싶다면 아래 영상을 시청해주세요! [10분 테코톡] ☂️ 검프의 Logging(로깅) #2 Logback 로깅 프레임워크 중 하나로, SLF4J의 구현체에요. SL

livenow14.tistory.com

 

반응형