0

Can ASP.NET's System.web.Management be used for logging events like user logins, password changes and access to certain resources? Should system.Web.Management be used for logging of errors and health monitoring instead?

I want to log events without re-inventing the whole thing. I know ELMAH is used for errors; can it be used for logging events too?

1 Answer 1

1

From the article ELMAH - Error Logging Modules And Handlers on the now defunct DoNetSlackers:

Error signaling is exposed via the ErrorSignal class, which provides a single overloaded method called Raise. Simply put, exceptions raised via the ErrorSignal class are not thrown, therefore they don't bubble up, but instead are only sent out to ELMAH, as well as to whomever subscribes to the Raise event of the ErrorSignal class.

The code snippet below shows how to obtain an instance of the ErrorSignal class, which is unique per application and can be retrieved simply with the static FromCurrentContext method, and then use it to signal an exception.

ErrorSignal.FromCurrentContext().Raise(new NotSupportedException());

The difference between signaling and throwing an exception is that in the first case no one will ever know about the error except ELMAH.

Further Reading:

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.