Search code examples
javaloggingjava-11java-17

Does upgrading to java17 affects the Logger?


I had a java 11 project, which printed logs to a file ussing the LOGGER. In my classes I used:

    private final static Logger LOGGER = LoggerFactory.getLogger(object.class);

to send info and errors to my log file. This file was determined in my application.properties by

logging.file=logs/file.log

Now this worked fine. I recently upgraded the project to Java17. Now I can still see the logs with 'journalctl -u program', but they don't get logged anymore into the previous designated file. First I had a 'SLF4J: class path contains multiple SLF4J bindings' warning, but I removed the conflicting dependency. When I go trough java17 changes, I see nothing regarding the Logger. But the file where the logs should be saved, remains empty.

Can upgrading to java17 interfer somehow with the logger? What could cause my logger not to log to the file anymore?


Solution

  • When I upgrade to Java17, I also upgraded the spring-boot-starter-parent to the latest version 2.7.3. Due to this upgrade, logging.file was deprecated and had to be replaced by logging.file.name. So upgrading to Java17 doesn't cause it, upgrading the spring-boot-starter-parent does.