I'm having a problem configuring log4j with Apache Tomcat 8.0.17. I'm using OpenSUSE 13.2 with OpenJDK 8.0:

linux:>java -version
openjdk version "1.8.0_40"
OpenJDK Runtime Environment (build 1.8.0_40-b10)
OpenJDK 64-Bit Server VM (build 25.40-b14, mixed mode)

I'm following the instructions in the log4j section of the Logging in Tomcat section of the Tomcat documentation. The steps do not appear to work, and there is no information in the log file that I can see that would assist me in troubleshooting this.

Referencing the steps:

1) I have created log4j.properties in $CATALINA_BASE/lib. The file is readable by the tomcat user.

linux:/srv/tomcat/lib # ls -al log4j.properties
-rw-r--r-- 1 root root 2343 Jan 21 12:57 log4j.properties

2) I have downloaded log4j 1.2 or later (version 2.1)
3) I have downloaded tomcat-juli-adapters.jar and tomcat-juli.jar
4) I have placed log4j.jar and tomcat-juli-adapters in $CATALINA_HOME/lib

linux:/usr/local/apache-tomcat-8.0.17/lib # ls -alh log4j-core-2.1.jar tomcat-juli-adapters.jar
-rw-r--r-- 1 root root 806K Jan 21 12:26 log4j-core-2.1.jar
-rw-r--r-- 1 root root  32K Jan 21 11:54 tomcat-juli-adapters.jar

I have replaced the tomcat-juli.jar in $CATALINA_HOME/bin with the one from the extras directory.

linux:/usr/local/apache-tomcat-8.0.17/bin # ls -al tomcat-juli.jar
-rw-r--r-- 1 root root 78644 Jan 21 11:55 tomcat-juli.jar

5) N/A
6) I have deleted logging.properties from $CATALINA_BASE/conf
7) I have started tomcat using JSVC with the command:

JSVC=/usr/local/bin/jsvc
$JSVC \
-cp $CATALINA_HOME/bin/bootstrap.jar:$CATALINA_HOME/bin/tomcat-juli.jar \
                -home $JDK_HOME \
                -user $TC_USER \
                -outfile $CATALINA_BASE/logs/catalina.out \
                -errfile $CATALINA_BASE/logs/catalina.err \
                -pidfile $PIDFILE \
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager \
                -Dorg.apache.juli.ClassLoaderLogManager.debug=true \
                -Dcatalina.base=$CATALINA_BASE \
                -Dcatalina.home=$CATALINA_HOME \
                -Djava.io.tmpdir=$CATALINA_BASE/temp \
                -Djava.awt.headless=true \
                -Dcatalina.port=$CATALINA_PORT \
                -Dmail.smtp.localhost=$FQDNHOSTNAME \
                $JAVA_MEM_OPTIONS \
                org.apache.catalina.startup.Bootstrap start

Examination of the $CATALINA_BASE/logs directory shows:

linux:/srv/tomcat/logs # ls -al
total 12
drwxrws--- 1 root   tomcat   186 Jan 21 12:57 .
drwxr-x--- 1 root   tomcat    90 Jan 21 12:56 ..
-rw------- 1 root   tomcat 11912 Jan 21 12:57 catalina.err
-rw------- 1 root   tomcat     0 Jan 21 12:57 catalina.out
-rw-r--r-- 1 tomcat tomcat 0 Jan 21 12:57 localhost_access_log.2015-01-21.txt

There are no mentions of log4j in catalina.err.

If someone could point me in the right direction, I would appreciate it.

Thanks in advance.

--
George Sexton
*MH Software, Inc.*
Voice: 303 438 9585
http://www.mhsoftware.com

Reply via email to