Configuring logback in Tomcat app

122 Views Asked by At

I have developed a JAR which I plan to use from a Tomcat app. The library depends on logback. During testing I've been using

-Dlogback.configurationFile=.\config\logback.xml

as a VM option to indicate the location of the configuration file.

How can I replicate the same thing in Tomcat? Note that logback can also find the configuration file on its own if its in the classpath. Is there a way to add the config file to the app's classpath in Tomcat?

1

There are 1 best solutions below

1
On

If you put it at the root of your Jar (src or src/main/resources), it will be available in Tomcat, too.