How do I get the Logging Block to eat all the exceptions?

Topics: Exception Handling Application Block, Logging Application Block
Jan 5, 2009 at 7:47 PM
Is it possible to get the Logging Block to log all exceptions thrown by a website just through configuration settings?

I currently have a custom implemented error logging that just attaches a Global Error Handler in the Global.asax file and just logs all application level exceptions...

The only way I can see to do this (with the Logging Block) would be to:

1) Replace what I have with the Exception Handling Application Block since it can be integrated with the Logging block
2) Use <healthmonitoring> and write my own WebEventProvider that sends all exceptions monitored to the Logger or to the Exception Handling Application Block so it can properly format and do it's thing....
Because the healthmonitoring automatically catches and logs all exceptions

Thank You
Jan 6, 2009 at 1:37 AM
You can also try this,

1. Configure your Logging Application Block.
2. Create an Exception Policy, use the base Exception type. 
3. Configure a Logging Handler for the Exception type.
4. Handle the exception in the Application_Error event in the Global.asax file.
    protected void Application_Error(object sender, EventArgs e)
Exception ex = Server.GetLastError();
ExceptionPolicy.HandleException(ex, "Exception Policy");

Sarah Urmeneta
Global Technology & Solutions
Avanade, Inc.

Jan 6, 2009 at 3:06 AM

That's exactly what I have now...

So cool :)

I guess I did it right than

Thanks for the reply