【发布时间】:2016-04-25 01:56:29
【问题描述】:
我正在尝试使用 Spring Boot 的日志记录配置编写 application.yml 文件。多亏了我上一个问题中的 Bal,我才能在 spring boot 的网站上查看sample file。因为我现在只想配置日志信息,所以我的 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.
但我有几个问题:
- 我应该在 yml 文件和
logback.xml文件中做多少日志配置?是否应该将任何日志记录配置放在此处而不是全部放在logback.xml中? - 日志级别配置行写对了吗?
- 我可以使用其他库的日志记录级别,例如 logback 吗?例如,我可以这样写:
ch.qos.logback.classic.Level=DEBUG
【问题讨论】:
标签: java logging configuration spring-boot logback