Frage

I have website and I need to log exceptions globally, cannot understand what is difference between using ELMAH as error logging mechanism or use Application_Error in Global.asax, I think that all will log all exceptions thrown, or I'm missing something about ELMAH

War es hilfreich?

Lösung

ELMAH subscribes to the same Error event that Application_Error in Global.asax is designed to handle. As a result, you will not be at any more disadvantage with Application_Error than ELMAH as far as getting notified when an unhanded exception bubbles up to ASP.NET during an HTTP transaction. The difference is that except for very simplistic logging, if your needs ever expand to configurability, filtering errors, generating RSS feeds or building a browsing UI around logged errors then you'll pretty much end up writing the same code in your Application_Error as ELMAH gives you. If you plan to use that code in Application_Error of other web applications, then it will need to be generalised and rendered pluggable and that, once again, will give you what ELMAH already is.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top