Dear Wiki user, You have subscribed to a wiki page or wiki category on "Tomcat Wiki" for change notification.
The "HowTo" page has been changed by KonstantinKolinko: http://wiki.apache.org/tomcat/HowTo?action=diff&rev1=120&rev2=121 Comment: Remove "How do I use log4j for all Tomcat log output?" entry. The text was old and wrong. This topic is covered by Tomcat docs. No. If you can edit Tomcat's startup scripts (or better create a {{{setenv.sh}}} file), you can add "-D" options to Java. But there is no way in Java to have different values of system properties for different classes in the same JVM. 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 use log4j for all Tomcat log output? == - 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: - - {{{ - 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? == On the Tomcat FAQ, there is a list of Other Resources which should have information pointing you to the relevant pages. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org