public void OnException(ExceptionContext filterContext) { LoggerFactory loggerFactory = new LoggerFactory(); ILoggerAdapter loggerAdapter = loggerFactory.GetLoggerAdapter(); loggerAdapter.Log(filterContext.Exception); filterContext.Result = new ViewResult { ViewName = "ServerError" }; filterContext.ExceptionHandled = true; filterContext.HttpContext.Response.Clear(); filterContext.HttpContext.Response.StatusCode = 500; filterContext.HttpContext.Response.TrySkipIisCustomErrors = true; }
private static void Log(this ILoggerAdapter logger, Type type, LoggingEventType loggingEventType, string message, Exception exception = null) { logger.Log(new LogEntry(type, loggingEventType, message, exception)); }