4

I am trying to use simplelogger.properties for my Java Spring project. Additionally I want to use Lombok @Slf4j annotation.

Unfortunately my simplelogger.properties is ignored. Changes in the logging level done there do not show any effect.

My pom.xml dependencies look like:

        <!-- SPRING -->
        ...

        <!-- LOMBOK -->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.10</version>
            <scope>provided</scope>
        </dependency>

        <!-- SLF4J -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.28</version>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>1.7.30</version>
            <scope>test</scope>
        </dependency>

What my simplelogger.properties looks like:

org.slf4j.simpleLogger.defaultLogLevel=debug
org.slf4j.simpleLogger.showDateTime=false
org.slf4j.simpleLogger.showThreadName=false
org.slf4j.simpleLogger.showLogName=false

What a usage of the logger would look like:

@Slf4j
public class Frankenstein {
    public Frankenstein() {
        log.debug("i am alive");
    }
}

I am not able to view the debug message by setting the logging level to debug within the simplelogger.properties.

I would like to use the simplelogger.properties to change the logging level.

  • I guess that this is not related to Lombok.`@SLF4J` only creates the logger field. – Roel Spilker Mar 25 '20 at 12:47
  • Old [question](https://stackoverflow.com/questions/13442967/how-to-dynamically-change-log-level-in-slf4j-or-log4j) - but with recent updates, and may be worth a look? Especially [this answer](https://stackoverflow.com/a/57572183/12567365)? – andrewJames Mar 27 '20 at 20:49
  • Yup. It seems to be ignored. Has anyone filed a defect fore this yet? – wilx Aug 19 '22 at 07:48
  • I take it back. It seems to work form me in the lastest 1.7.x version. – wilx Aug 19 '22 at 08:05
  • I am no longer working on the project. Therefore I con give no update if the new version solves the problem for me too. Nevertheless, it is nice to see that it is working for for you with version 1.7.x – CoffeeKangaroo Sep 01 '22 at 08:03

0 Answers0