Can't reinstall Tomcat webapp because of log4j.properties locked

W

willirl

I've got a webapp that uses log4j for logging. The log4j.properties
file is in the classes directory of the application. Logging works
fine.

Problem is when I try to (using ANT) redeploy the application. This
first removes the application then installs a new jar.

It appears that Tomcat is unable to remove the log4j.properties file
because it is "in use". (The application has been stopped at this
point). So the new install fails until I manually restart tomcat at
which point the properties file can be deleted and all works fine.

Any ideas of how I can get Tomcat to "release" the properties file.
Is this a bug in log4j = not closing properties file after reading it?
 
S

Sebastian Millies

Am 23 Feb 2005 05:19:02 -0800 schrieb willirl:
I've got a webapp that uses log4j for logging. The log4j.properties
file is in the classes directory of the application. Logging works
fine.

Problem is when I try to (using ANT) redeploy the application. This
first removes the application then installs a new jar.

It appears that Tomcat is unable to remove the log4j.properties file
because it is "in use". (The application has been stopped at this
point). So the new install fails until I manually restart tomcat at
which point the properties file can be deleted and all works fine.

Any ideas of how I can get Tomcat to "release" the properties file.
Is this a bug in log4j = not closing properties file after reading it?

I've not had that problem, but then I'm using a different approach:
the log4j config sits in the WEB-INF directory and I read it
with getResourceAsStream from my initialization-Servlet.
-- Sebastian
 
W

willirl

Good solution. I'll try that approach. How do I load the properties
from the file into log4j?
 
S

Sebastian Millies

Am 23 Feb 2005 09:55:29 -0800 schrieb willirl:
Good solution. I'll try that approach. How do I load the properties
from the file into log4j?

Just call the Configurator's configure() method. -- Sebastian
 

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

No members online now.

Forum statistics

Threads
473,992
Messages
2,570,220
Members
46,807
Latest member
ryef

Latest Threads

Top