How can I change the default location of log4j2.xml in Java Spring Boot?

后端 未结 6 1315
醉梦人生
醉梦人生 2020-12-14 09:37

Log4j2 is working nicely with Spring Boot through the log4j2.xml configuration file in the root classpath, exactly as the documentation states.

When try

6条回答
  •  遥遥无期
    2020-12-14 09:55

    In case of property file:

    java -Dlog4j.configuration=file:/path/to/log4j.properties -jar app.jar

    To the command line works in Spring Boot 2. Don't forget to add file: before the path.

提交回复
热议问题