You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-dev@logging.apache.org by "Graham (JIRA)" <ji...@apache.org> on 2006/10/27 15:27:23 UTC

[jira] Commented: (LOG4NET-99) File locking issues

    [ http://issues.apache.org/jira/browse/LOG4NET-99?page=comments#action_12445186 ] 
            
Graham commented on LOG4NET-99:
-------------------------------

Extra note: 

I have tried releasing the lock on the file log4net has myself (using win32 UnlockFile and Unlock on the FileStream itself) but it seems that there really is no 'real' lock on the file as these calls report that it has been released.





> File locking issues
> -------------------
>
>                 Key: LOG4NET-99
>                 URL: http://issues.apache.org/jira/browse/LOG4NET-99
>             Project: Log4net
>          Issue Type: Bug
>          Components: Appenders
>    Affects Versions: 1.2.10
>         Environment: Windows XP, NET 2.0
>            Reporter: Graham
>            Priority: Critical
>
> Hi,
> I wonder if you can throw some light / provide a solution for the problem which I am having using Log4Net under .NET 2.0 (v 1.2.10) (problem also seems to occur under v1.2.9) After setting up a logger to log to the console, provide trace output and to log to an XML file using a minimal lock, the following calls are fine...
> (i.e. both messages find their way to the file)
> logger.warn(msg); 
> logger.warn(msg); 
> this is also works without a problem 
> logger.fatal(msg); 
> logger.fatal(msg); 
> however if I do the following; 
> logger.warn(msg); 
> logger.critical(msg); 
> the second message never gets written to the file. The console error stream tells me it was due to a locking problem. The exact message as follows; 
> "log4net:ERROR [RollingFileAppender] Unable to acquire lock on file C:\Tests.XML. The process cannot access the file 'C:\Tests.XML' because it is being used by another process."
> In addition, if I attempt to open a stream to the file after making a logging call then an exception will be thrown (message similar to above)
> UNLESS I open one which is read only
> I have also found that although log4net seems to be able to deal with problem when two calls are made in the same scope at the same threshold, (i.e. it will write both messages to the file), but trying to open a stream to the file inbetween calls still throws an exception.
> Regards,
> Graham

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira