...
There are some other methods available, like using ServletContext.getContextPath()
to get the context name of your web application and locate some resources accordingly, or to define <context-param>
elements in WEB-INF/web.xml
file of your web application and then set the values for them in Tomcat context file (META-INF/context.xml
). See http://tomcat.apache.org/tomcat-7.0-doc/config/context.html .
How do I
...
To have Tomcat use log4j universally, place both log4j.jar
and the Jakarta commons-logging.jar
into the $TOMCAT_HOME/common/lib
directory. Create your log4j properties file as $TOMCAT_HOME/common/classes/log4j.properties
and configure the root logger. Here is the basic log4j.properties
that I used to do this myself:
No Format |
---|
log4j.rootLogger=info, R
log4j.appender.R=org.apache.log4j.ConsoleAppender
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%-5p %-30.30c{1} %x - %m%n
|
If you only need to use log4j in your own web app, just include log4j (and any log4j properties file) in your WAR file.
How do I configure Tomcat Connectors?
...