Externalized the location of logback.xml in Spring Boot using application.properties

无人久伴 提交于 2020-01-01 04:43:07

问题


How can I customized the location of logback.xml in Spring Boot using application.properties?

I tried below but is not working.

application.properties

logging.config = /home/dev-01/Documents/logback.xml

It is working if the logback.xml is located in the resource folder, but not working if it is located outside the project.

It is also working if the I supply as environment variable like

-Dlogging.config=/home/dev-01/Documents/logback.xml

回答1:


Below construct worked for me (but I used relative path instead of absolute):

logging.config=file:/home/dev-01/Documents/logback.xml


来源:https://stackoverflow.com/questions/32944356/externalized-the-location-of-logback-xml-in-spring-boot-using-application-proper

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!