默认的Spring Boot log4j2日志模式 [英] Default Spring Boot log4j2 log pattern

查看:225
本文介绍了默认的Spring Boot log4j2日志模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Spring Boot附带了几种默认的日志框架配置,包括Log4j2.尽管在Spring Boot参考手册中有关于日志记录的详细文档,但没有提及如何以及在何处准确配置默认日志模式,这使得覆盖它变得很困难.

Spring boot ships with several default logging framework configurations including Log4j2. While there is detailed documentation about logging in the Spring boot reference manual it does not mention how and where exactly the default log pattern is configured, which makes it difficult to override this.

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

The question is where does Spring Boot configure the default log pattern of for Log4j2?

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

So far I have looked in the following places of Spring Boot:

AutoConfigurationReportLoggingInitializer
LoggingApplicationListener
SimpleFormatter
LoggingSystem
Log4J2LoggingSystem

推荐答案

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

It seems the Log4J2 configuration is not done in any Java class so I was looking at the wrong place. Spring Boot ships with two files log4j2.xml and log4j2-file.xml which contain the default configuration and can be found in org.springframework.boot.logging.log4j2.

这篇关于默认的Spring Boot log4j2日志模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆