Log4net logging calls, i.e.
log4net.LogManager.GetLogger("zzz").Debug("bar"), are thread safe and
there is no need to add additional synchronisation.Cheers, Nicko > -----Original Message----- > From: Stewart, Mark (GE Consumer Finance, consultant) > [mailto:[EMAIL PROTECTED] > Sent: 18 July 2005 20:59 > To: Log4NET User > Subject: RE: Log4Net Threading Error? > > > Thanks for the tip on DOMConfigurator.Configure. I will make > sure I call it just once at application startup. Perhaps that > contributed to my problem. > Nevertheless, I am routing all my logging calls through a > central method which has thread locking and then calls the > appropriate log4net method. > That should catch any threading conflicts. > > Thanks, > Mark > > -----Original Message----- > From: Nicko Cadell [mailto:[EMAIL PROTECTED] > Sent: Monday, July 18, 2005 12:38 PM > To: Log4NET User > Subject: RE: Log4Net Threading Error? > > > 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. > > Cheers, > Nicko > > > -----Original Message----- > > From: Stewart, Mark (GE Consumer Finance, consultant) > > [mailto:[EMAIL PROTECTED] > > 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 > > >
