Skip to content
Advertisement

Log4j2 log file not created

For a spring-boot application I’m trying to set up a log4j2 logger that will write the logs into a few sperate files, but the logs are only written to the console, I’ve checked my user_dir to make sure I’m not looking in the wrong location as well.

This is the code that should write the test logs:

JavaScript

this is my log4j2.xml file:

JavaScript

this is my build.gradle file:

JavaScript

Advertisement

Answer

The issue was that spring-boot couldn’t recognize the log4j2.xml file because of the files structure.

The file has to be located directly in src/main/resources

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement