Logging : Event Log is Corrupted

Topics: Logging Application Block
Jun 13, 2007 at 10:13 PM
My application behaved erratically and threw exceptions when i was trying to log an error into the event log. I cleared the event log and it started working properly. Wondering if there is any thing that can be done to ensure that no exception is thrown when writing into a corrupt event log and the application just doesnt write to the eventlog if the eventlog is corrput?
Jun 14, 2007 at 3:29 PM
There is a special source in the Logging Application Block, called Logging Errors & Warnings, where errors are logged if the Logging Application Block cannot log to a TraceListener. I am surprised you were getting exceptions, because you are not supposed to. The errors are typically suppressed and show up in the TraceListener defined in Logging Errors & Warnings. It is your job to monitor the special source and make any corrections as necessary.

However, if you pointed the Logging Errors & Warnings to the EventLog, too, does the block not tell you logging is not happening? I can see people complaining about that.

You may want to choose another TraceListener like a Rolling Flat File that you can delete periodically if you are concerned about corrupted and full EventLogs.

Regards,

Dave

_______________________________

David Hayden
Microsoft MVP C#