Spring boot log4j file external to jar?

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

Transfer: -Dlog4j.configuration = file: /// c: \ log4j2.xml on the command line does not work (although it works in a non-w760> -boot test application itโ€™s just fine).

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

+5
source share
2 answers

Try putting this line in your application.properties :

 logging.config=file:log4j.xml 

The second parameter is to pass the system variable to -Dlogging.config=file:log4j.xml

In this case, it is expected that it will be in the current directory outside the JAR file.

+4
source

you should put "-Dlog4j" before "-jar XXXX.jar". And try this for yourself .work for me.

0
source

All Articles