【发布时间】:2016-11-16 03:59:08
【问题描述】:
在我的spring-boot 应用程序中,我使用logback 进行日志记录。该应用程序使用外部application.properties 文件来设置环境特定的应用程序属性,并以选项开头:-spring.config.location=path/to/file。我希望 logback 配置也可以从那里读取属性,以便在一个地方管理所有环境属性。
我尝试了here 描述的方法,但由于属性文件不在类路径上,我收到错误:
java.lang.IllegalStateException: Logback configuration error detected:
ERROR in ch.qos.logback.core.joran.action.PropertyAction - Could not find resource [application.properties]
我有什么遗漏吗?
更新:
添加此配置有效:
<property file="path/to/file" />
但我想避免硬编码文件路径。
【问题讨论】:
标签: java spring spring-boot logback