Two processes cannot have an exclusive lock on a file. The minimal lock (as the name implies) does in fact lock the file for a short period of time. A mutex is a good way to allow multiple processes to coordinate file writes:
http://www.mail-archive.com/[email protected]/msg04116.html A similiar locking model will most likely be included in the next release. ----- Original Message ---- From: "Pattenaude, Jerry" <[EMAIL PROTECTED]> To: Log4NET User <[email protected]> Sent: Monday, March 17, 2008 2:18:57 PM Subject: RE: logging from web service and a web page <!-- _filtered {font-family:Tahoma;panose-1:2 11 6 4 3 5 4 4 2 4;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0in;margin-bottom:.0001pt;font-size:12.0pt;font-family:"Times New Roman";} a:link, span.MsoHyperlink {color:blue;text-decoration:underline;} a:visited, span.MsoHyperlinkFollowed {color:purple;text-decoration:underline;} span.EmailStyle17 {font-family:Arial;color:windowtext;} span.EmailStyle19 {font-family:Arial;color:navy;} _filtered {margin:1.0in 1.25in 1.0in 1.25in;} div.Section1 {} --> I’ve dug into my problem a little bit more and have some addition information. I’m still hoping that someone will have run into this and/or knows this to be a limitation of the file appender. My web service app and my asp.net app are separate visual studio projects. Both projects reference log4net.dll. When aspnet_wp.exe loads the applications it loads log4net.dll twice into the same aspnet_wp process, but different app domains. It appears that even with minimal lock the file is still locked, so it cannot be used from a different app domain in the same process. Does anyone have any ideas on this? Is it a log4net bug? Thanks. Sent:Wednesday, March 12, 2008 1:10 PM To:[email protected] Subject: logging from web serviceand a web page I have had a web service logging for a while now and it works great (I’ll call it ws). The log4net.dll runs in the standard aspnet_wp.exe and logs using the rollingfileappender with minimal lock. <lockingModel type="log4net.Appender.FileAppender+MinimalLock" /> I’ve recently added another module to my site that does some session management as part of the ASP.Net pipeline. It is logging using the same configuration file and the same output file. Now the session module is getting created first and all of its log messages are getting through, but the ws app log messages are not being created. I turned on the debug for log4net and am running DebugView and I get the following log4net:ERROR [RollingFileAppender] Unable to acquire lock on file c:\log\Log.txt. Access to the path 'c:\log\Log.txt' is denied. So just to recap the ws messages were getting through. I added the session dll and now its messages are getting through and not my ws messages. When I remove the session dll then the ws messages start coming through again. Oh and just to add a little more info when I turn on the Event Log Appender all the messages get logged. Do you have any idea what would cause this? Thanks in advance, jerry This e-mail is confidential and is intended solely for the use of the addressee(s). Content is not to be relied upon by any person other than the addressee(s), without prior written approval of RedPrairie. If you are not the intended recipient, please notify us immediately, destroy any copies and delete from your computer systems. If you have received this e-mail in error, any use, disclosure, dissemination, forwarding, printing or copying is strictly prohibited. Although this email and any attachments are believed to be free of any virus or other defects which might affect any computer or IT system into which they are received, no responsibility is accepted by RedPrairie for any loss or damage arising in any way from the receipt or use therein.
