Anand Hemmige
Anand Hemmige

Reputation: 3683

tomcat override logging.properties include in a shared library

I deploy my app in tomcat6.

One of the shared jars in my war file has a logging.properties that is overriding the logging provided by tomcat.

Is there any way to override a logging.properties file in a shared jar by a custom logging.properties file.?

UPDATE:

I see in the jvm start command line this statement

-Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties ,

but it does not seem to be overriding the file included in the shared jar file.

Upvotes: 2

Views: 2779

Answers (1)

jmehrens
jmehrens

Reputation: 11065

Per the Tomcat 6 logging documentation the logging is configured the following ways:

  • Globally. That is usually done in the ${catalina.base}/conf/logging.properties file. The file is specified by the java.util.logging.config.file System property which is set by the startup scripts. If it is not readable or is not configured, the default is to use the ${java.home}/lib/logging.properties file in the JRE.
  • In the web application. The file will be WEB-INF/classes/logging.properties

If the shared library is placing the logging.properties in WEB-INF/classes you'll have to remove it. If it is not placed there, then the shared library contains code that is calling LogManager.readConfiguration. If that is the case you should be able to call LogManager.getLogManager().reset() after the shared library has been loaded. This will force the configuration back to defaults described in the Tomcat docs.

Upvotes: 4

Related Questions