我正在尝试使用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.
但我有几个问题:
logback.xml
文件中执行多少日志记录配置?是否应将任何日志记录配置放在此处,而不是全部放在logback.xml
?ch.qos.logback.classic.Level=DEBUG
答案 0 :(得分:1)
logback.xml
与application.yml
合并。如果对您来说足够,可以通过application.yml
使用简化配置或使用" fullfeatured" logback.xml
。说实话,我不确定当这两个文件中的配置有矛盾时会发生什么(例如不同的模式或日志级别)。
2 + 3.我的猜测是你有额外的logging
部分。正确的例子就是例如。
logging:
level:
ch.qos.logback.classic: DEBUG
org.hibernate: INFO