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 "Frank W. Zammetti" <fz...@omnytex.com> on 2004/09/27 05:14:26 UTC

Clear open log file?

Hello all.  I know I've asked this before, but I keep hoping a different 
set of eyes will see it and have an answer for me...

I have a webapp that logs to a file using Log4J... I'd like to add a 
facility to the system to be able to clear the open log file at any 
time.  I haven't found a way to do it.  I've thought about maybe 
figuring out a way to close the log and open a new one, but logically 
I'd expect that to fail at least sometimes because another log request 
could fire while it's being done.

Anyone know of a way to do this?  Thanks very much!

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com


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


RE: Clear open log file?

Posted by Ivan Jouikov <iv...@ablogic.net>.
I can suggest a "heavy" work around...  When you want to clear it - turn off your log4j (by re-configuring it... like using BasicConfigurator or something), that should release the lock on the log file, then you can delete it by normal means, and then you can reconfigure log4j to use that file again.  It's a little heavy on performance, but it should work.

> -----Original Message-----
> From: Frank W. Zammetti [mailto:fzlists@omnytex.com]
> Sent: Sunday, September 26, 2004 8:14 PM
> To: Log4J User
> Subject: Clear open log file?
> 
> Hello all.  I know I've asked this before, but I keep hoping a different
> set of eyes will see it and have an answer for me...
> 
> I have a webapp that logs to a file using Log4J... I'd like to add a
> facility to the system to be able to clear the open log file at any
> time.  I haven't found a way to do it.  I've thought about maybe
> figuring out a way to close the log and open a new one, but logically
> I'd expect that to fail at least sometimes because another log request
> could fire while it's being done.
> 
> Anyone know of a way to do this?  Thanks very much!
> 
> --
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.766 / Virus Database: 513 - Release Date: 17.09.2004
> 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.766 / Virus Database: 513 - Release Date: 17.09.2004
 


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