使用Spring Boot配置Log4j2.properties

Mar*_*cus 3 log4j2 spring-boot

Spring Boot 1.5.2是否可以使用log4j2属性配置而不是xml?

官方spring文档上的日志文档似乎表明只支持xml.

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

Man*_*dis 8

是的你可以.在我的情况下,我无法让Spring Boot找到我的log4j2.properties.我必须在里面指定application.properties:

logging.config=src/main/resources/log4j2.properties
Run Code Online (Sandbox Code Playgroud)

如果我log4j2.xml在同一个文件夹中,我不必这样做