Externalizing the location of logback.xml in Spring Boot using application.properties(使用Applation.Properties将logback.xml在Spring Boot中的位置外部化)
问题描述
如何使用Applation.Properties在Spring Boot中自定义logback.xml的位置?
我已在下面尝试,但不起作用。
应用程序.属性
logging.config = /home/dev-01/Documents/logback.xml
如果logback.xml位于资源文件夹中,则它可以工作,但如果它位于项目之外,则不能工作。
如果I作为环境变量提供,则它也可以工作,如
-Dlogging.config=/home/dev-01/Documents/logback.xml
推荐答案
以下构造适用于我(但我使用的是相对路径而不是绝对路径):
logging.config=file:/home/dev-01/Documents/logback.xml
这篇关于使用Applation.Properties将logback.xml在Spring Boot中的位置外部化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!