The log4j2 file is not read

Good morning everyone,

To complete my project I would need to use log4j2 for the various log levels.
I followed the various guides on the internet and you simply need to add a file with an xml extension or properties under the resources package but when the application starts the log4j2 file is not read.
I have done a lot of tests, but nothing does not happen-

Can anyone help me?

Thanks in advance.

Cattura

Hi Leonardo,

The first search result that I got for “spring boot log4j2” is this one: Logging in Spring Boot | Baeldung

Do you really need Log3j2 instead of default Logback? If so, try to follow this guide, it also requires excluding Logback from dependencies.

1 Like