コード例 #1
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            base.OnActionExecuting(filterContext);

            try
            {
                FilterContext = filterContext;
                Log           = AppLogFactory.Create <ActionTrackerAttribute>();
                Log.Trace("Executing {0}.{1}", ControllerName, ActionName);
                Watch = Stopwatch.StartNew();
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex);
            }
        }
コード例 #2
0
        protected void Application_Start()
        {
            //var target = LogManagement.GetAsyncDbWrapperTarget();
            //target.OverflowAction = AsyncTargetWrapperOverflowAction.Grow;

            var log = AppLogFactory.Create <MvcApplication>();

            log.Info("Application starting");

            AreaRegistration.RegisterAllAreas();
            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            AuthConfig.RegisterAuth();
            AutoMapping.CreateMaps();

            log.Info("Application started");
        }
        public void OnException(ExceptionContext exceptionContext)
        {
            if (exceptionContext.ExceptionHandled)
            {
                return;
            }

            if (ConfigurationManager.AppSettings["enableErrorPages"] == "false")
            {
                AppLogFactory.Create <AppErrorHandlerAttribute>().Error(
                    "Unexpected error. enableErrorPages is false, skipping detailed error gathering. Error was: {0}",
                    exceptionContext.Exception.ToString());
                return;
            }

            Ensure.That(Reporter, "Reporter").IsNotNull();
            Reporter.ReportException(exceptionContext);

            SetErrorViewResult(exceptionContext);
        }