Tomcat can't find log4j properties file in war file

J

Jim

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
help

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:
<param-value>hspLog4j.properties</param-value>
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
"webapps".

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
[hspLog4j.properties].
java.io.FileNotFoundException: hspLog4j.properties (No
such file or directory)
at java.io.FileInputStream.open(Native
Method)
.....
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top