Event Viewer EventLog Thread-Safety

parabellum
parabellum used Ask the Experts™
on
Hello

I want to use Event Viewer for logging of my application services. I know that i must use EventLog class.Please note that my application has several threads.

So my question is:
I am not  sure that EventLog class is thread-safe. How can i write my log entries to Event Viewer from multiple threads. Actually an example or a simple code snippet(that is thread safe) would be great.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
The public static membersof EventLog are threadsafe according to MS:

http://msdn.microsoft.com/en-us/library/system.diagnostics.eventlog%28v=VS.80%29.aspx

Once the event source is set up, you only need EventLog.WriteEntry (which is public static).
Commented:
Yes. It is thread-safe. I have done it before - years ago.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial