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:
  1. Remove the dependency slf4j-log4j12
  1. Include dependency spring-boot-starter-log4j2:
    1. In dependency spring-boot-starter remove the spring-boot-starter-logging:

      References


      © Foy Wan 2022 - 2025