Peter, If you are running two separate process that are trying to log to the same file, which is in effect the situation with a web garden, then you will have a locking issue. By default the FileAppender takes an exclusive lock on the output file, this prevents any other processes writing to the file.
Either you need to write to different files from each of the separate processes. For example by using a pattern string to set the file name: <file type="log4net.Util.PatternString" value="file[%processid].log" /> Or you can configure the FileAppender to use minimal locking, the appender will open and close the file for each logging event, allowing interleaved writing from multiple processes. To use the minimal lock then add this to your FileAppender or RollingFileAppender: <lockingModel type="log4net.Appender.FileAppender+MinimalLock" /> Cheers, Nicko > -----Original Message----- > From: Peter Landis [mailto:[EMAIL PROTECTED] > Sent: 12 May 2005 06:50 > To: Log4NET User > Subject: RE: Log4Net on Windows 2000 and Windows 2003 > > The problem seems to be related to the Application Pool "Web > garden" max number of worker processes. > > I had the worker process set to "2" which causes log4net to > lose it's logging capabilities though sessions via a contention issue. > > It has been noted by MS that "Web Gardens...if your worker > processes are all attempting to log information to a log file > or use a resource and that usage was not designed for > multiple, simultaneous access, then you may have contention issues." > > Once I set the web gardens work process to 1 this resolved the issue. > > Has anyone else experienced similiar issues with Web Garden > work process set other than 1? > > reference link: > http://www.microsoft.com/technet/community/columns/insider/iis > i0803.mspx#ECAA > > -Pete > > --- Peter Landis <[EMAIL PROTECTED]> wrote: > > > Nicko- > > I have downloaded the latest log4net 1.2.9 and also made > the change > > in the Con fig initialization by placing it inside the > Global.as ax.cs > > Application_Start method. I have made the changes and > uploaded it to > > the URL for your cross-reference. > > > HTTP://www.cs.um.Edi/~landis/CookieLog4NetExample.zip > > > > The issue is when you close the existing browser and open another > > browser window (new session), log4net losses it's logging ability. > > > > To help pinpoint the exact cause of steps: > > 1) You must run this on Windows 20003 (IIS 6) > > 2) Using IE 6 browser (also Firefox!) > > 3) Go to the URL > > http://localhost/TestLog4Net/test.aspx > > 4) Refresh the browser 20 times real fast. The cookie will > display 20 > > and also the log file will display 20 results. > > 5) Now close the existing browser (killing the existing session). > > 6) Open up a new browser and go to the same URL > > 7) The session should display Cookie Count: 0 > > 8) Refresh 20 times in a row and this is when the log file starts > > responding sporadiacally. > > > > Note that this is only a problem on Windows 2003 (IIS 6). > Everything > > works just fine on Windows 2000 Server IIS 5 and WinXP. > > > > Currently the only solution I have found is to restart the logging > > ability is to recycle the IIS Application Pool which is not > acceptable > > for a production environment. > > > > I am going to download the tools you mentioned to help > debug log4net > > but first wanted to see with the above steps that you are able to > > replicate the issue. > > > > Regards, > > Peter > > > > > > --- Nicko Cadell <[EMAIL PROTECTED]> wrote: > > > > > Peter, > > > > > > I have run your cookie test on a fresh install of > > > Win2k3 and can't > > > recreate the issue you are reporting. Both the GET and > POST versions > > > increment the cookie value displayed and write to the log file, > > > there are no missing events in the log. Obviously I > haven't put it > > > under much load, just some manual testing. > > > > > > Some things that you may be able to do to resolve this. > > > > > > Try using the latest version of log4net. It looks like > you are using > > > one from 3 years ago, try the 1.2.9 beta from > > > http://logging.apache.org/log4net/downloads.html > > > > > > If log4net encounters errors during operation it writes > them to the > > > OutputDebugString handler. You can use the dbgview tool from > > > http://www.sysinternals.com to view these > > messages. > > > > > > Don't reload the config file for each request. > > This > > > is first of all a > > > big performance overhead, secondly under high load this > will lead to > > > dropped messages. If you use a more recent version of > log4net then > > > it can be configured to watch a configuration file > > for > > > changes and reload > > > automatically. If you have your config in the Web.config of an > > > ASPNET app there is little point in watching or reloading > the config > > > as ASPNET will automatically restart the web app if the > web.config > > > is changed. > > > > > > Cheers, > > > > > > Nicko > > > > > > > -----Original Message----- > > > > From: Peter Landis [mailto:[EMAIL PROTECTED] > > > > Sent: 10 May 2005 05:17 > > > > To: Log4NET User > > > > Subject: Re: Log4Net on Windows 2000 and Windows > > > 2003 > > > > > > > > I have pinpointed the issue to be related to a > > > form POST > > > > requests but like Kevin mentioned it could be a > > > caching > > > > problem. I would like to find out how to > > resolve > > > this issue > > > > on Windows 2003 (IIS 6). > > > > > > > > A reference to a simple cookie example that I > > > created using > > > > log4Net can be downloaded at > > > > > > > > > > http://www.cs.uwm.edu/~landis/CookieLog4NetExample.zip > > > > > > > > Log4Net works just fine when you access the page > > > and refresh > > > > over again. The cookie label stays in sync with > > > the log file. > > > > http://localhost/testlog4net/test.aspx > > > > > > > > Now if you access the page with a form request > > > going to > > > > http://localhost/test.html and submit the POST > > > request and > > > > try it over again, log4net on Windows 2003 (IIS > > 6) > > > some how > > > > caches the log4net request and then logs > > > sporadically. You'll > > > > notice that the cookie is still incremented on > > the > > > page but > > > > the logging is not. > > > > > > > > This example works with no problems on Windows > > > 2000 on IIS 5. > > > > > > > > No clue on what is going on with log4net on IIS > > 6. > > > > > > > > > > > > > > > > > > > > --- Kevin Williams <[EMAIL PROTECTED]> wrote: > > > > > > > > > Sounds like a caching problem. Something is > > > caching the > > > > page - perhaps > > > > > IIS, the browser, or something else. > > > > > > > > > > Shoaib Shakoor wrote: > > > > > > Hi > > > > > > Same logging and logger works perfectly fine > > > on my > > > > > own machine using > > > > > > Windows XP, even i updated any file it does > > > not > > > > > stopt eh process of > > > > > > logging. > > > > > > Regards > > > > > > Shoaib > > > > > > > > > > > > On 5/10/05, Shoaib Shakoor > > > > > <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > >>Hi > > > > > >>I am facing the same problem when i deployed > > > the > > > > > application on the > > > > > >>machine using Server 2003, the application > > > Logs > > > > > for the first time and > > > > > >>some times it stops doing the logging any > > > where in > > > > > the middle. > > > > > >>When i updated any file of the application , > > > it > > > > > stops the logging > > > > > >>process. The only solution i found so far is > > > to > > > > > restart the server > > > > > >>every time when i updated any file on the > > > machine > > > > > using Windows server > > > > > >>2003. > > > > > >>How can i fix this problem > > > > > >>Regards > > > > > >>Shoaib Shakoor > > > === message truncated === > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection > around http://mail.yahoo.com >
