logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicko Cadell" <ni...@neoworks.com>
Subject RE: Log4net seems to hang when starting up windows service
Date Sat, 22 Oct 2005 20:05:17 GMT
Gary, I haven't heard anything about potential hangs in
Process.GetCurrentProcess() do you have any references for this?

John, Can you test this by removing the %r pattern from your appenders?

Cheers,
Nicko

> -----Original Message-----
> From: Gary Overholt [mailto:gary_overholt@yahoo.com] 
> Sent: 22 October 2005 01:40
> To: log4net-user@logging.apache.org
> Subject: RE: Log4net seems to hang when starting up windows service
> 
> John,
> 
> 
> I hit this same problem a couple of weeks ago after I 
> converted from the 1.2.b8 version to the current verion of 
> log4net. After looking at this list and not finding anyone 
> else having this problem (until now) I looked at the log4net code.
> 
> After doing a bit of debugging I found the program hangs 
> because of the use of the %r in the conversion pattern and 
> tracked it to this line in the file
> Util/SystemInfo.Cs:
> 
> 
>  s_processStartTime = 
> System.Diagnostics.Process.GetCurrentProcess().StartTime;
>      
> After looking on the web, I found references indicating that 
> the System.Diagnostics.Process.GetCurrentProcess property 
> sometime stalls in certain conditions.
> 
> So what I did was replace this line in Util/SystemInfo.Cs :
> 
> 	private static DateTime s_processStartTime = DateTime.MinValue;
> 
>   with:
> 
> 	private static DateTime s_processStartTime = DateTime.Now;
> 
> 
> This effectivly changes the %r conversion pattern to report 
> ticks since the
> SystemInfo Class was loaded rather than the actual start of 
> the program.   So
> beware of this.
> 
> As a side effect I no longer get negative ticks like I 
> sometimes used to. This happened when the code did not hang 
> but threw an exception in trying to get the process start 
> time and set the s_ProcessStartTime to DateTime.Now - which 
> was after the time of the event that was being logged.
> 
> This is just a patch to allow me to run log4net in a Windows 
> services ( I also suspect ASP.Net Apps and Web Services but 
> have no evidence to support it) and there may be another 
> cause - but it worked for me.  Perhaps the log4net guru's 
> have some insight on this.
> 
> - gary
> 
> 
> 
> Gary Overholt 
> 
> (303)359-9924
> gary_overholt@yahoo.com
> 
> 
> 	
> 		
> __________________________________
> Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com
> 
> 

Mime
View raw message