specify custom logging.properties under tomcat
Asked Answered
P

1

5

I'd like to have 2 webapp under a tomcat, the 2 project should have their own logging.properties. I know this is possible, if you put logging.properties in the war file, but I'd like to specify a custom loggin.properties file (out of my deployed war). Is that possible?

Porringer answered 27/5, 2013 at 11:28 Comment(0)
P
3

You can specify what file will be used. The ${catalina.base}/conf/logging.properties file is referenced by Tomcat startup scripts,

catalina.sh :

LOGGING_CONFIG (Optional) Override Tomcat's logging config file
LOGGING_CONFIG="-Djava.util.logging.config.file=$CATALINA_BASE/conf/logging.properties"

But you can not use two separate properties files for separate applications at this level. If you require separate (per app) settings, you need to use your local app WEB-INF/classes/logging.properties file (means yes, you should put it to your war file).

Another solution is to use log4j (http://tomcat.apache.org/tomcat-7.0-doc/logging.html#Using_Log4j) which is way more flexible. log4j.properties sits inside $CATALINA_BASE/lib, it has all settings inside one config (properties) file, but you can configure separate log4j.appender for every application and log each application to separate log file. You can have DEBUG log level for one app, and simple INFO for another app.

Primordial answered 27/5, 2013 at 11:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.