views:

641

answers:

3

Hi all,

I'm trying to log all exceptions to a sql server database through log4net, and I've seen some posts here explaining how to properly configure the web.config file, but my question is: do it is enough to get the exception logged (the application will log automatically, but in this case it does not work on my app), or do I have to call the logger from code-behind into try/catch statement?

Any suggestion would be appreciated!

Thanks a lot, Epros

A: 

There is nothing to auto-catch, you need to hook up your unhandled exception to do the logging (in the same way you'd hook it up to do any other global exception management).

Ruben Bartelink
+1  A: 

You can user Application_Error in global.asax. This is called when an unhandler error occurs.

Sascha
A: 

This might help.

Arnis L.