Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configuring Log4j2.properties with Spring Boot

Is it possible on Spring Boot 1.5.2 to use log4j2 property configuration as opposed to xml?

The logging documentation over on the official spring docs seems to indicate only xml is supported.

https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-logging.html

like image 591
Marcus Avatar asked Sep 16 '25 08:09

Marcus


1 Answers

Yes you can. In my case I couldn't get Spring Boot to find my log4j2.properties. I had to specify inside application.properties:

logging.config=src/main/resources/log4j2.properties

Whereas I didn't have to do that if I had log4j2.xml in the same folder

like image 158
Manos Nikolaidis Avatar answered Sep 18 '25 10:09

Manos Nikolaidis