Class path contains multiple SLF4J bindings
date
Aug 24, 2022
slug
Class-path-contains-multiple-SLF4J-bindings
status
Published
tags
Bugfix
Log4j
Log
SLF4J
Spring Boot
summary
type
Post
Background
I added the dependency for logging with
Log4j
:Problem
However, when I started the application I received the error below:
What’s wrong
That was because
Spring Boot
was still using default logging framework, which is logback
, also implements SLF4J
.Solution
To solve this problem, follow the steps below:
- Remove the dependency
slf4j-log4j12
- Include dependency
spring-boot-starter-log4j2
:
- In dependency
spring-boot-starter
remove thespring-boot-starter-logging
: