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 Threading Error?
Date Mon, 18 Jul 2005 19:37:55 GMT
I think this is coming from a Console.Out.WriteLine call. As far as I am
aware this should be thread safe, indeed looking at the exception stack
it looks like Console.Out is a SyncTextWriter. My first guess is that
this is a thread safety issue in the .NET core library :(

However log4net should not be chucking out this sort of exception. This
was fixed as part of http://issues.apache.org/jira/browse/LOG4NET-26 and
will be part of the next release.

Out of interest is there a good reason that you are calling
DOMConfigurator.Configure from WMService.Data.Oracle..ctor? If possible
you should try to minimise the number of times you call
DOMConfigurator.Configure. You should try to do it once at start-up
rather during execution.


> -----Original Message-----
> From: Stewart, Mark (GE Consumer Finance, consultant) 
> [mailto:mstewart@wmcdirect.com] 
> Sent: 06 July 2005 22:06
> To: Log4NET User
> Subject: Log4Net Threading Error?
> I have gotten the following error in my log4net log.  This 
> application can have multiple threads writing to the same log 
> file.  The Message and the trace stack below point to log4net...  
> Any comments or ideas?
> (Using = VS.NET 2003, and log4net (1.2.0 Beta 9)
> 2005-05-12 17:53:43,863 [1420] FATAL 
> WMService.Control.Process [] - 
> WMService.Service.ReceiveMessage() had an Exception
> Exception: System.IndexOutOfRangeException
> Message: Probable I/O race condition detected while copying 
> memory.  The I/O package is not thread safe by default.  In 
> multithreaded applications, a stream must be accessed in a 
> thread-safe way, such as a thread-safe wrapper returned by 
> TextReader's or TextWriter's Synchronized methods.  This also 
> applies to classes like StreamWriter and StreamReader.
> Source: mscorlib
>    at System.Buffer.InternalBlockCopy(Array src, Int32 
> srcOffset, Array dst, Int32 dstOffset, Int32 count)
>    at System.IO.StreamWriter.Write(Char[] buffer, Int32 
> index, Int32 count)
>    at System.IO.TextWriter.WriteLine(String value)
>    at System.IO.SyncTextWriter.WriteLine(String value)
>    at log4net.helpers.LogLog.Debug(String msg)
>    at 
> log4net.Config.DOMConfigurator.Configure(ILoggerRepository repository)
>    at log4net.Config.DOMConfigurator.Configure()
>    at WMService.Data.Oracle..ctor()
>    at WMService.Control.Process.ReceiveMessage(MessageQueue 
> messageQueue)
> Thanks,
> Mark

View raw message