Elmah will automatically catch unhandled exceptions.
By tracing, I think, you mean logical exceptions which are processed?
If you want to manually log processed exceptions, the process in MVC is the same as for ASP.NET:
Add the Elmah DLL reference to your project, and then use Elmah.ErrorSignal.FromCurrentContext().Raise(), for example:
try
{
throw new ApplicationException("raised for elmah to catch");
}
catch (System.ApplicationException ae)
{
Elmah.ErrorSignal.FromCurrentContext().Raise(ae);
}
source
share