The Mutext stuff works great for allowing two AppDomains (i.e. "two .NET 
processes") to write to the same file without having to open and close the file 
after each write. If IIS forceably kills the old AppDomain becuase its taking 
too long to finish its requests will the new AppDomain get an 
AbadonedThreadException because the old AppDomain has the Mutext while it was 
writing to the file. I posted some additional thoughts on the issue here:

 
http://www.ayende.com/Blog/archive/2008/02/28/The-mysterious-life-of-mutexes.aspx#feedback

I'm thinking adding in file open retries would a less hetic approach than 
tracking down the relationship between IIS, AppDomain resets, process 
termination, finalizers, and Mutexes.

----- Original Message ----
From: Erich Eichinger <[EMAIL PROTECTED]>
To: Log4NET User <[email protected]>
Sent: Thursday, February 28, 2008 6:06:21 AM
Subject: RE: log4net and IIS problems

Honestly I didn't do it in .NET yet, but from Win32 API I remember, that there 
was some "OpenOrCreate" Option for CreateMutex(). The return value of the 
function indicated, wheter the Mutex was newly created or just opened. I think 
there is some similar option in .NET, which at least allows for communication 
between the 2 processes.
 
Maybe an option to defer persisting LogEvents until all Appenders are ready 
might be a better idea? In this case the new AppDomain would cache all 
LogEvents in memory until they can be appended.
 
-Erich

________________________________

From: Ron Grabowski [mailto:[EMAIL PROTECTED]
Sent: Thu 2008-02-28 00:38
To: Log4NET User
Subject: Re: log4net and IIS problems


Didn't quite finish my thought...I meant to say that we could add an 
EventLogErrorHandler to catch edge cases like this. To address the underlying 
problem, someone posted some code to the control inter-process/AppDomain 
locking using a Mutext. My concern is what happens if the terminal AppDomain 
requests the Mutex then is forceably killed? According the Mutex docs on MSDN 
an Exception will be thrown when the new AppDomains attempts to open that 
Mutext.


----- Original Message ----
From: Ron Grabowski <[EMAIL PROTECTED]>
To: Log4NET User <[email protected]>
Sent: Wednesday, February 27, 2008 6:04:19 PM
Subject: Re: log4net and IIS problems


"Common" was maybe a bad choice of words. If its reproducable 


----- Original Message ----
From: Walden H. Leverich <[EMAIL PROTECTED]>
To: Log4NET User <[email protected]>
Sent: Wednesday, February 27, 2008 4:07:26 PM
Subject: RE: log4net and IIS problems



> Is this is a common problem?

 

Yup. I know I've run into it a few of times. Of course, since log4net will fail 
silently (a good thing) it may be even more prevalent that I think, after all, 
how many people will know they're missing log entries?

 

-- 

Walden H Leverich III
Tech Software
(516) 627-3800 x3051

[EMAIL PROTECTED]
http://www.TechSoftInc.com

Quiquid latine dictum sit altum viditur.
(Whatever is said in Latin seems profound.) 

 






Reply via email to