views:

200

answers:

1

I would like to log unhandled exceptions from the global.asax to the Application eventlog. However, I've noticed that IIS is already logging these unhandled exceptions as warnings. Is there a way to suppress these messages since I'm planning on logging them myself or do you think it’s reasonable to have both entries there (the event log entry logged by IIS and my event log entry)?

UPDATE:

Thank you John Saunders for pointing me in the right direction. It was in fact health montioring that was doing the logging based on the default configuration in the root web.config.

A: 

You would do better to find out what those entries are. They're not from IIS, they're from ASP.NET Health Monitoring.

That's an extensible mechanism, and you may want to extend it instead of rolling your own. For instance, it's trivial to conifgure it to also log application start and end, in order to keep track of AppDomain restarts. You can also add data tot he "web events" that it logs, and configure where the log information will be sent.

See ASP.NET Health Monitoring Overview.

John Saunders
I should clarify that I am using Log4Net and not rolling my own logging framework.
tribus
Good clarification, but you should learn about ASP.NET Health Monitoring anyway.
John Saunders