I am currently designing the logging componet of a larger software
project (C#, .NET 2.0, Log4Net 1.2.10).  It's basically a custom logging API
which uses Log4Net behind the scenes.  The project involves multiple
processes, some of which have multiple threads.  It is also a requirement
that all configuration must be done programmatically rather than with a
config file (i.e. defining the name of log files at runtime).  We initially
chose Log4Net because it says right in the FAQ that it's thread safe, and I
think we just took that at face value.  Once I started digging into
programmatic configuration API, however, I saw that all the useful classes
like Hierarchy and Logger, all the Appenders, etc. seem to be labelled as
NOT thread safe.

  This leaves me with a few questions that I haven't been able to find
answers to in the mailing list archives or docs.  First, under what
circumstances IS Log4Net thread-safe?  My understanding is that it's safe as
long as I don't directly access classes like Logger in my code and instead
use the "normal" XML file config methods, is that correct?  And if so, is
there any reason that I can't just write my own thread sync code around the
Log4Net calls to ensure that no two threads are making them simultaneously?

Reply via email to