You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Fredrik Jonson <fr...@myrealbox.com> on 2005/02/08 12:36:02 UTC

Stale file handles when using log4j and tomcat?

Hello,

When checking with lsof, I see that log4j seem to maintain file descriptors to log files even after I have stopped and even removed the webbapp which logs to that particular logfile.

I use log4j (1.2.7/9) and tomcat 4.1.31 on linux and java-1.4.2. Log4j is placed in the WEB-INF/lib directory, and isn't shared between apps, though several webbapps use log4j for logging.

Is there any trick to make log4j close logfiles when the webbapp is stopped?

I seem to recollect a previous discussion on a related topic on this list, but now I cant find it again.

-- 
Fredrik Jonson
-- 
fredrik@myrealbox.com

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


RE: Stale file handles when using log4j and tomcat?

Posted by Andy McBride <an...@dsl.pipex.com>.
Hi,

Have you tried using a ServletContextListener which calls
org.apache.log4j.LogManager.shutdown() in its contextDestroyed method?

This should allow log4j a chance to close any resources when you stop the
webapp context.

Regards

Andy

> -----Original Message-----
> From: Fredrik Jonson [mailto:fredrik@myrealbox.com]
> Sent: 08 February 2005 11:36
> To: log4j-user@logging.apache.org
> Subject: Stale file handles when using log4j and tomcat?
>
>
> Hello,
>
> When checking with lsof, I see that log4j seem to maintain file
> descriptors to log files even after I have stopped and even
> removed the webbapp which logs to that particular logfile.
>
> I use log4j (1.2.7/9) and tomcat 4.1.31 on linux and java-1.4.2.
> Log4j is placed in the WEB-INF/lib directory, and isn't shared
> between apps, though several webbapps use log4j for logging.
>
> Is there any trick to make log4j close logfiles when the webbapp
> is stopped?
>
> I seem to recollect a previous discussion on a related topic on
> this list, but now I cant find it again.
>
> --
> Fredrik Jonson
> --
> fredrik@myrealbox.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org