Search This Blog

Tuesday, January 15, 2013

Oddity when working with event logs

During development I often create then delete custom Windows event logs for my applications.

A problem arises when I do something like delete and then recreate an event log and event source in order to correct a spelling or something like that ... I'm able to delete the old log and the source but when I recreate the new (correctly spelled) log and source I will see the new log appears but I can't seem to write to it anymore.

There's a peculiarity with Windows event logs -- if you delete them and then recreate them, you need to reboot the computer for writing to the event log to begin behaving correctly again.  See:

http://stackoverflow.com/questions/1901312/eventlog-createeventsource-is-not-creating-a-custom-log

and

http://msdn.microsoft.com/en-us/library/2awhba7a.aspx (about half way down the page)

No comments: