Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Logback configuration via jvm argument

How can we load logback.xml via jvm argument if this is not present in project classpath?

I'm using

 -Dlogback.configuration=file:C:\logbacs\logback.xml  

but this is not working.

like image 519
Sai prateek Avatar asked Oct 22 '13 13:10

Sai prateek


People also ask

How do I setup a Logback XML file?

In a Logback. xml file, all the configuration options are enclosed within the <configuration> root element. In the root element, you can set the debug=true attribute to inspect Logback's internal status. You can also configure auto scanning of the configuration file by setting the scan=true attribute.

How do I specify the path for Logback xml?

You may specify the location of the default configuration file with a system property named "logback. configurationFile". The value of this property can be a URL, a resource on the class path or a path to a file external to the application.


1 Answers

I found the solution

-Dlogging.config="C:\logbacs\logback.xml" 

is working fine for me.

Updated because the previous answer was obsolete

like image 103
Sai prateek Avatar answered Sep 27 '22 20:09

Sai prateek