Skip to content
Advertisement

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

Advertisement

Answer

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

logging.config=file:/home/dev-01/Documents/logback.xml
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement