What method/line did you modify RollingFileAppender? ----- Original Message ---- From: Mike Blake-Knox <[EMAIL PROTECTED]> To: Log4NET Dev <[email protected]> Sent: Friday, October 27, 2006 9:13:09 AM Subject: Re: [jira] Created: (LOG4NET-99) File locking issues
On 10/27/06, Graham (JIRA) <[EMAIL PROTECTED]> 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
