External location of logback.xml in Spring Download using application.properties

How can I configure the location of logback.xml in spring boot using application.properties?

I tried below but not working.

application.properties

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

It works if logback.xml is in the resource folder, but does not work if it is outside the project.

It also works if I provide an environment variable like

 -Dlogging.config=/home/dev-01/Documents/logback.xml 
+5
source share
1 answer

The below constructor worked for me (but I used a relative path instead of an absolute one):

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

Source: https://habr.com/ru/post/1232949/


All Articles