I try to use environment aware log4j properties files in Spring Boot application, for example, log4j.properties is used for development and log4j-uat.properties for UAT environment as showed in picture.
- following Extern log4.properties file with Spring Boot, I added logging.config=log4j-uat.properties to application-uat.properties and get exception said cannot find that properties file.
- following https://github.com/spring-projects/spring-boot/issues/1348, I added parameter when starting the application as java -jar logger-server.jar --spring.profiles.active=uat -Dlogging.config=classpath:log4j-uat.properties. However, it seems that the uat log4j properties is always overwritten by the default log4j properties.
Could anyone please advise me how to make Spring Boot pick up the log4j properties files for different environments?
Thanks, Sean