[英]Configuring Spring Boot Logback
I am trying to write the application.yml
file with the logging configurations for spring boot. 我正在尝试使用spring boot的日志记录配置来编写
application.yml
文件。 Thanks to Bal from my previous question I was able to take a look at the sample file on spring boot's website. 感谢上一个问题中的Bal,我得以查看Spring Boot网站上的示例文件 。 Since I only want to configure the logging information for now here is what my yml file looks like right now:
由于我现在只想配置日志记录信息,因此这是我的yml文件现在的样子:
# ===================================================================
# SPRING BOOT PROPERTIES
# ===================================================================
# LOGGING
logging:
config: /logback.xml # Location of the logging configuration file. For instance `classpath:logback.xml` for Logback
logging.level.org.springFramework=DEBUG # Log levels severity mapping. For instance `logging.level.org.springframework=DEBUG`
path: # Location of the log file. For instance `/var/log`
pattern:
console: # Appender pattern for output to the console. Only supported with the default logback setup.
file: # Appender pattern for output to the file. Only supported with the default logback setup.
level: # Appender pattern for log level (default %5p). Only supported with the default logback setup.
But I have a few questions: 但是我有几个问题:
logback.xml
file? logback.xml
文件中进行多少日志记录配置? Should any logging configuration be put here at all versus putting it all in logback.xml
? logback.xml
? ch.qos.logback.classic.Level=DEBUG
ch.qos.logback.classic.Level=DEBUG
logback.xml
with application.yml
. logback.xml
与application.yml
结合在一起。 Use either simplified configuration via application.yml
if it is enough for you or use "fullfeatured" logback.xml
. application.yml
使用简化的配置,或者使用“ logback.xml
” logback.xml
。 To be honest I am not sure what will happen when you will have contradicting configuration in those two files (eg different patterns or log levels). 老实说,我不确定当这两个文件中的配置矛盾时(例如,不同的模式或日志级别)会发生什么。
2 + 3. My guess is you have extra logging
part. 2 +3。我猜是您还有额外的
logging
部分。 Correct example would be eg 正确的例子是
logging:
level:
ch.qos.logback.classic: DEBUG
org.hibernate: INFO
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.