コード例 #1
0
        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;
        }
コード例 #2
0
ファイル: LoggerExtensions.cs プロジェクト: ILearny/log4net
 private static void Log(this ILoggerAdapter logger, Type type, LoggingEventType loggingEventType, string message,
                         Exception exception = null)
 {
     logger.Log(new LogEntry(type, loggingEventType, message, exception));
 }