I am developing an API Service Layer for a client and I have been requested to catch and log all errors globally.
So, while something like an un
Why rethrow etc? This works and it will make the service return status 500 etc
public class LogExceptionFilter : ExceptionFilterAttribute
{
private static readonly ILog log = LogManager.GetLogger(typeof (LogExceptionFilter));
public override void OnException(HttpActionExecutedContext actionExecutedContext)
{
log.Error("Unhandeled Exception", actionExecutedContext.Exception);
base.OnException(actionExecutedContext);
}
}