Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

How can I customize 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 an environment variable like

-Dlogging.config=/home/dev-01/Documents/logback.xml
like image 207
richersoon Avatar asked Oct 05 '15 08:10

richersoon


1 Answers

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

logging.config=file:/home/dev-01/Documents/logback.xml
like image 77
luboskrnac Avatar answered Oct 21 '22 01:10

luboskrnac