Writing to the Windows Event Log

July 6, 2009

Writing errors to the Windows event log can be tricky, especially with permissions on custom folders.  Here’s a simple method that won’t require special permissions

using System.Diagnostics;

EventLog log = new EventLog();
log.Source = “Application”;
log.WriteEntry(“Your Message”, EventLogEntryType.Error);

If you’re capturing web service exceptions, be sure to capture the SoapException and write the Detail xml node.

Entry Filed under: Programming. Tags: .

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


Calendar

July 2009
M T W T F S S
    Sep »
 12345
6789101112
13141516171819
20212223242526
2728293031  

Most Recent Posts