logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Milind Rao" <mili...@bellsouth.net>
Subject RE: File locking in FileAppender
Date Mon, 14 Jul 2003 11:42:56 GMT
Thanks for the quick response.  I don't see anything specifically written about file locking
in the java.io.Writer.

FileOutputStream javadocs does say that 
    "Some platforms, in particular, allow a file to be opened for writing by only one FileOutputStream

    (or other file-writing object) at a time. In such situations the constructors in this
class will fail if the file 
    involved is already open."

On Windows I can definitely open the same file for writing in 2 processes.  There is no failure
in the constructor.  So 
should I assume that there is no file locking on Windows?  The "write" method is native as
you said, but there is no 
documentation on the implementation.  

On Mon, 14 Jul 2003 12:49:30 +0100, Thomas Muller wrote:

>Milind,
>
>The appenders are indeed threadsafe. Consult java.io.Writer to learn how
>this class controls concurrent write operations. The FileOutputStream are
>implemented using native methods and uses OS specific file locks to enforce
>concorrency control.
>
>Hope this helps.
>
>--
>
>Thomas
>
>| -----Original Message-----
>| From: Milind Rao [mailto:milindr@bellsouth.net]
>| Sent: 14 July 2003 12:18
>| To: Log4J Users List
>| Subject: File locking in FileAppender
>|
>|
>| Is FileAppender thread safe?  I don't see any file locking
>| occuring in the FileAppender & WriterAppender classes.
>|
>| If I have 2 processes writing to the same log file, could I get a
>| conflict?
>| If I have 2 threads writing to the same log file, could I get a conflict?
>|
>| I haven't been able to get a conflict, but that of course doesn't
>| mean anything.  Threading problems are not that easy to
>| simulate.
>|
>| Category.callAppenders() locks on the category, but that
>| shouldn't be doing anything for file locking.
>|
>|
>|
>| Regards
>| Milind
>|
>|
>|
>| ---------------------------------------------------------------------
>| To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
>| For additional commands, e-mail: log4j-user-help@jakarta.apache.org
>|
>|
>
>
>
>*************************************************************************
>Copyright ERA Technology Ltd. 2003. (www.era.co.uk). All rights reserved. 
>The information supplied in this Commercial Communication should be treated
>in confidence.
>No liability whatsoever is accepted for any loss or damage 
>suffered as a result of accessing this message or any attachments.
>
>________________________________________________________________________
>This email has been scanned for all viruses by the MessageLabs Email
>Security System. For more information on a proactive email security
>service working around the clock, around the globe, visit
>http://www.messagelabs.com
>________________________________________________________________________
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: log4j-user-help@jakarta.apache.org
>



Regards
Milind



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


Mime
View raw message