Tomcat's catalina.properties contains...

common.loader=${catalina.home}/lib,${catalina.home}/lib/*.jar

This means that, assuming that "/usr/share/tomcat6" is the path set for ${catalina.home}, the following should work fine...

/usr/share/tomcat6/lib/log4j.jar
/usr/share/tomcat6/lib/log4j.properties


That said, is you purpose application logging or server logging (or both)?

For application logging, this should be fine, though you'll share a logger repository with all apps under Tomcat (unless you include log4j.jar in WEB-INF/lib and log4j.properties or log4j.xml in WEB-INF/classes ....or you use a logger repository selector).

For server logging, you need to following the instructions you already referenced....

http://tomcat.apache.org/tomcat-6.0-doc/logging.html#log4j


Jake

On Thu, 15 Jul 2010 10:20:59 -0700
 Kevin Kruzich <kkruz...@mshift.com> wrote:

I was able to get log4j working with syslog without too much trouble
using tomcat5. Yet with tomcat6 I'm having a heck of a time trying to
figure out where log4j.properties should go.

tomcat5:

JAVA_OPTS="$JAVA_OPTS
-Dcatalina.ext.dirs=$CATALINA_HOME/shared/lib:$CATALINA_HOME/common/lib"

/var/lib/tomcat5/common/lib/log4j.jar
/var/lib/tomcat5/common/classes/log4j.properties

works great!

---

tomcat6:

tomcat    9995  0.5  1.2 649772 24900 ?        Sl   21:01   0:03
/usr/bin/java -classpath
:/usr/share/tomcat6/bin/bootstrap.jar:/usr/share/tomcat6/bin/tomcat-juli.jar:/usr/bin/build-classpath: error: JVM_LIBDIR /usr/lib/jvm-exports/java-1.6.0 does not exist or is
not a directory -Dcatalina.base=/usr/share/tomcat6
-Dcatalina.home=/usr/share/tomcat6 -Djava.endorsed.dirs=
-Djava.io.tmpdir=/var/cache/tomcat6/temp
-Djava.util.logging.config.file=/usr/share/tomcat6/conf/logging.properties
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
org.apache.catalina.startup.Bootstrap start


/usr/share/tomcat6/lib/log4j.jar
/usr/share/tomcat6/lib/log4j.properties

(and many other locations)

fails, fails...

*?* Do I need a dir like /usr/share/tomcat6/common

These instructions are over 8 years old so I imagine this section, in
particular has changed quite a bit "Default Initialization under Tomcat"


http://logging.apache.org/log4j/1.2/manual.html


---

And lastly, there's this snippet on the Apache website -- is all this
necessary?

http://tomcat.apache.org/tomcat-6.0-doc/logging.html#log4j

# Download Log4J (v1.2 or later) and place the log4j jar in
$CATALINA_HOME/lib.
# Build or download the additional logging components. See the extras
components documentation for details.
# Replace $CATALINA_HOME/bin/tomcat-juli.jar with
output/extras/tomcat-juli.jar.
# Place output/extras/tomcat-juli-adapters.jar in $CATALINA_HOME/lib.
# Delete $CATALINA_BASE/conf/logging.properties to prevent
java.util.logging generating zero length log files.
# Start Tomcat


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org

Reply via email to