Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Tomcat can't find log4j properties file in war file

Thread Tools

Tomcat can't find log4j properties file in war file

Posts: n/a
I have a web app served by Tomcat on a Unix system which I have been running
out the development environment. I am trying to deploy it as a jar file.
When the log4j logging system starts up it says it cannot find the
properties file in the war file.

Do I have to specify the properties file location differently?

More detailed information is below.
Any suggestions will be greatly appreciated; I thank you in advance for your

Jim Cant

At startup, Tomcat loads a servlet to initialize the log4j logging system;
the name of an initialization file is given in the servlet element in the
web.xml file:
The log file is located in the directory 'docBase' in server.xml, specified
with an absolute path:
<Context path="/HSP" docBase="/home/jcant/HSP/WebApp" .....
This works fine and logging gets initialized.

However, when I jar up the development into HSP.war and point Tomcat at it,
the properties file is not found.
I change server.xml so docBase="HSP.war" and also set 'appbase' to point to

When Tomcat is restarted, the web app runs fine out of the war file but the
logging never gets initialized. The log file has the error message
log4j:ERROR Could not read configuration file
[]. (No
such file or directory)
The properties file is in the root of the war file which is the
corresponding place to the 'WebApp' directory when running from the
development environment.

When I look in $TOMCAT_HOME/work/Standalone/localhost/HSP, I see the WEB-INF
directory and subdirectories has been deployed but no other files in the war
file are there.

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Does "additivity" flag in work only with log4j or with Apache Commons Logging as well? Gianni Galore Java 0 09-08-2010 09:26 AM
Can't reinstall Tomcat webapp because of locked willirl Java 3 02-24-2005 01:05 PM
Log4J properties for WebApp on Tomcat 4.1 jAnO! Java 2 07-23-2004 09:08 AM
Tomcat Cannot Find file John Java 3 07-20-2004 04:04 PM
Using log4j with Tomcat 4.1.30 problems with Rodolfo Java 0 07-12-2004 08:56 AM