C# TraceSource class in multithreaded application

Posted by matti on Stack Overflow See other posts from Stack Overflow or by matti
Published on 2009-12-15T17:05:39Z Indexed on 2010/03/19 22:01 UTC
Read the original article Hit count: 449

Filed under:
|
|

msdn: "Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe." it contains only instance methods.

How should I use it in a way that all activity gets recorder by TextWriterTraceListener to a text file. Is one static member which all threads use (by calling) TraceEvent-method safe.

(I've kind of asked this question in http://stackoverflow.com/questions/1901086/how-to-instantiate-c-tracesources-to-log-multithreaded-asp-net-2-0-web-applica, but I cannot just believe if somebody just says it's OK despite the documentation).

© Stack Overflow or respective owner

Related posts about c#

Related posts about tracing