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 14:25:16 UTC
[jira] Created: (LOG4NET-99) File locking issues
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
Re: [jira] Created: (LOG4NET-99) File locking issues
Posted by Mike Blake-Knox <mi...@gmail.com>.
On 10/27/06, Graham (JIRA) <ji...@apache.org> wrote:
> 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."
Are you perhaps simultaneously viewing C:\Tests.XML with some other
program when you get the error? I received similar errors while I was
trying to "follow" a log4net log file with various programs. If this
is the cause of the problem, I've used two approaches to work around
it. When I wrote the program viewing the log file, I was able to
resolve the problem by using file sharing mode of "FileShare.ReadWrite
| FileShare.Delete" when I opened the stream.
I also have modified the RollingFileAppender to catch the exception,
wait a little while then try to open the file again. I'd use this
approach only if I couldn't use the previous approach.
Hope this helps
Mike
[jira] Resolved: (LOG4NET-99) Resolved
Posted by "Ron Grabowski (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/LOG4NET-99?page=all ]
Ron Grabowski resolved LOG4NET-99.
----------------------------------
Resolution: Invalid
Reporter said the issue was solved.
> Resolved
> --------
>
> Key: LOG4NET-99
> URL: http://issues.apache.org/jira/browse/LOG4NET-99
> Project: Log4net
> Issue Type: Bug
> Affects Versions: 1.2.10
> Reporter: Graham
> Priority: Trivial
>
--
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
[jira] Closed: (LOG4NET-99) Resolved
Posted by "Ron Grabowski (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/LOG4NET-99?page=all ]
Ron Grabowski closed LOG4NET-99.
--------------------------------
Resolution: Invalid
> Resolved
> --------
>
> Key: LOG4NET-99
> URL: http://issues.apache.org/jira/browse/LOG4NET-99
> Project: Log4net
> Issue Type: Bug
> Affects Versions: 1.2.10
> Reporter: Graham
> Assigned To: Ron Grabowski
> Priority: Trivial
>
--
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
[jira] Commented: (LOG4NET-99) Resolved
Posted by "Graham (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/LOG4NET-99?page=comments#action_12445189 ]
Graham commented on LOG4NET-99:
-------------------------------
This has been resolved.
> Resolved
> --------
>
> Key: LOG4NET-99
> URL: http://issues.apache.org/jira/browse/LOG4NET-99
> Project: Log4net
> Issue Type: Bug
> Affects Versions: 1.2.10
> Reporter: Graham
> Priority: Trivial
>
--
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
[jira] Reopened: (LOG4NET-99) Resolved
Posted by "Ron Grabowski (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/LOG4NET-99?page=all ]
Ron Grabowski reopened LOG4NET-99:
----------------------------------
Assignee: Ron Grabowski
Re-opened so it can be marked as Closed.
> Resolved
> --------
>
> Key: LOG4NET-99
> URL: http://issues.apache.org/jira/browse/LOG4NET-99
> Project: Log4net
> Issue Type: Bug
> Affects Versions: 1.2.10
> Reporter: Graham
> Assigned To: Ron Grabowski
> Priority: Trivial
>
--
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
[jira] Updated: (LOG4NET-99) File locking issues
Posted by "Graham (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/LOG4NET-99?page=all ]
Graham updated LOG4NET-99:
--------------------------
Description: (was: 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
)
> 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
>
--
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
[jira] Updated: (LOG4NET-99) Resolved
Posted by "Graham (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/LOG4NET-99?page=all ]
Graham updated LOG4NET-99:
--------------------------
Component/s: (was: Appenders)
Summary: Resolved (was: File locking issues)
Environment: (was: Windows XP, NET 2.0)
Priority: Trivial (was: Critical)
> Resolved
> --------
>
> Key: LOG4NET-99
> URL: http://issues.apache.org/jira/browse/LOG4NET-99
> Project: Log4net
> Issue Type: Bug
> Affects Versions: 1.2.10
> Reporter: Graham
> Priority: Trivial
>
--
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
[jira] Commented: (LOG4NET-99) File locking issues
Posted by "Graham (JIRA)" <ji...@apache.org>.
[ 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