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

Discussion in 'Java' started by willirl, Feb 23, 2005.

  1. willirl

    willirl Guest

    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?
    willirl, Feb 23, 2005
    #1
    1. Advertising

  2. 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
    Sebastian Millies, Feb 23, 2005
    #2
    1. Advertising

  3. willirl

    willirl Guest

    Good solution. I'll try that approach. How do I load the properties
    from the file into log4j?
    willirl, Feb 23, 2005
    #3
  4. 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
    Sebastian Millies, Feb 24, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jim
    Replies:
    0
    Views:
    5,954
  2. Rodolfo
    Replies:
    0
    Views:
    939
    Rodolfo
    Jul 12, 2004
  3. jAnO!
    Replies:
    2
    Views:
    531
    Son KwonNam
    Jul 23, 2004
  4. Replies:
    1
    Views:
    424
    =?ISO-8859-1?Q?Arne_Vajh=F8j?=
    Jun 3, 2007
  5. Gianni Galore
    Replies:
    0
    Views:
    1,244
    Gianni Galore
    Sep 8, 2010
Loading...

Share This Page