I need to implement Error Logging in my ASP.NET MVC application, , My question is as follows, is there any way I can trigger a method (would this be a method that would write the error log, e-mail, and the like exception handling) whenever an Exception occurs anywhere in my code, it is not necessarily within a try catch block. Example:
//Este método fica na "Escuta" a espera de que ocorra uma exception em qualquer parte do código
public void Exception_Listener(Exception ex){
//Grava o log de erro
GravarLogErro(ex);
}
The idea of this is that I use the call of the method BurnLogErro () in only one part of the application, and not in all my Blocks of Try Catch, because if I implement an extra parameter in this method I would have to turn all the Try Catch of the application to inform the parameter.
I hope you understand me. Thank you very much.