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 sed <se...@gmail.com> on 2007/11/22 19:02:34 UTC

File appender that does not lock the file

Hi,

Has log4j file append that does not lock file? So I can delete my to
that log4j is writing logs and log4j will create file again.

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


Re: File appender that does not lock the file

Posted by Curt Arnold <cu...@comcast.net>.
On Nov 22, 2007, at 12:02 PM, sed wrote:

> Hi,
>
> Has log4j file append that does not lock file? So I can delete my to
> that log4j is writing logs and log4j will create file again.
>

I do not believe it would be possible to do so in platform  
independent manner.  On Unix's, I believe that "deleting" the file  
while log4j was logging would not cause any interruption, only the  
directory entry would be changed immediately and the file would be  
deleted when closed by log4j.  On WIndows, you'd either not be able  
to delete the file, but if you were able to delete the file then  
subsequent writes would fail and you could potentially recover as you  
suggest, but there is no mechanism to specify the locking behavior.

You might consider using ExternallyRolledFileAppender which will  
rename the current file when it receives a signal.

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