log4j2 – slf4j 연동 처리

    implementation 'org.apache.logging.log4j:log4j-core:2.19.0'
    implementation 'org.apache.logging.log4j:log4j-api:2.19.0'
    implementation 'org.apache.logging.log4j:log4j-slf4j2-impl:2.19.0'
    implementation 'org.apache.logging.log4j:log4j-jcl:2.19.0'
    implementation 'org.apache.logging.log4j:log4j-web:2.19.0'

    implementation 'org.slf4j:slf4j-api:2.0.3'
    implementation 'org.slf4j:jcl-over-slf4j:2.0.3'
    implementation 'org.slf4j:log4j-over-slf4j:2.0.3'

여기서 가장 중요한 것 .. 

Slf4j 2.0 이상 버전과 log4j2를 연결하기 위해서는  log4j-slf4j2-impl 패키지를 설치해줘야 한다. 

Slf4j 1.7 이하 버전과 log4j2를 연결하기 위해서는  log4j-slf4j-impl 패키지를 설치해줘야 한다. 

안그러면 바인딩이 제대로 안되서 로그가 나오지 않는다. 

이거때문에 하루 날림 .. 

<참조>

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

Leave a Reply

Your email address will not be published. Required fields are marked *