默认 Spring Boot log4j2 日志模式

lan*_*oxx 6 log4j2 spring-boot

Spring Boot 附带了几个默认的日志框架配置,包括 Log4j2。虽然 Spring boot 参考手册中有关于日志记录的详细文档,但它没有提及默认日志模式的具体配置方式和位置,这使得很难覆盖它。

问题是 Spring Boot 在哪里配置 Log4j2 的默认日志模式?

到目前为止,我已经查看了 Spring Boot 的以下位置:

AutoConfigurationReportLoggingInitializer
LoggingApplicationListener
SimpleFormatter
LoggingSystem
Log4J2LoggingSystem
Run Code Online (Sandbox Code Playgroud)

lan*_*oxx 5

看来 Log4J2 配置没有在任何 Java 类中完成,所以我找错了地方。Spring Boot 附带两个文件log4j2.xmllog4j2-file.xml其中包含默认配置,可以在org.springframework.boot.logging.log4j2.