Home > Net >  Application logging not working after upgrading springboot
Application logging not working after upgrading springboot

Time:10-14

After updating the spring boot version I started getting the following error at the beginning of the app and the logs are not following the logging.pattern.level from the application.properties and I updated them to

logging.pattern.level: "%clr{%5p} %clr{[%X{traceId}/%X{spanId}]}{yellow}"

Now I am getting an error

We still have an issue :
SLF4J: Failed to load class "org.slf4j.impl.StaticMDCBinder".
SLF4J: Defaulting to no-operation MDCAdapter implementation.
SLF4J: See http://www.slf4j.org/codes.html#no_static_mdc_binder for further details.

Please help me fix it

CodePudding user response:

As per the error looks like the binder class is missing. Instead of adding the log4j based dependencies manually maybe you can add spring-boot-starter-log4j2 dependency instead and see if this helps:

Gradle:

compile "org.springframework.boot:spring-boot-starter-log4j2"

Maven:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>
  • Related