Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

spring boot log4j file external to jar?

how to pass? The only way I can get this to work is to put log4j.xml on the classpath.

passing: -Dlog4j.configuration=file:///c:\log4j2.xml on the command line doesn't work (although it does in a non spring-boot test application just fine).

I also tried putting this as an environment variable/property in spring.

like image 728
mtmattek Avatar asked Sep 02 '15 15:09

mtmattek


1 Answers

Try to put this line into your application.properties:

logging.config=file:log4j.xml

Second option is to pass system variable to -Dlogging.config=file:log4j.xml

In this case it is expected to be located in current directory outside of the JAR file.

like image 158
luboskrnac Avatar answered Oct 06 '22 13:10

luboskrnac