Logging Application Block & Multi-threading

Topics: Logging Application Block
Mar 26, 2009 at 9:46 AM

I am new to the Logging application block (4.1). Has anyone written an application that uses the Logging application block from multiple threads? I am asking because the Logger is a static class and because of potential writing to the same log file from multiple threads for example.

Mar 26, 2009 at 11:24 AM
Hi SunnyGirl, I'm honestly not sure but I'll just rely on this statement from the documentation.
"Any instance members are not guaranteed to be thread safe.".

However, I can tell you that when two or more tracelisteners are trying writing to the same log file at the same time, it will cause to create other guid-named files.  This behavior is inherent
from the  .Net Framework textwritertracelistener.  The usual workaround to this is using the Distributor Service which you can also find in the documentation. 

Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.