Ejemplo n.º 1
0
        private static void LogError(Events.DomainEvent domainEvent, System.Exception exception)
        {
            var errorLogCommand = new AddErrorLogCommand();

            errorLogCommand.ErrorObject = domainEvent;
            errorLogCommand.Exception   = exception;

            InjectContainer.GetInstance <ICommandBus>().Send(errorLogCommand);
        }
        public void OnException(ExceptionContext context)
        {
            //获取当前的访问路径
            var pa = context.HttpContext.Request.Path;
            // IServiceProvider serviceProvider = context.HttpContext.RequestServices.GetService<I>();

            AddErrorLogCommand log = new AddErrorLogCommand()
            {
                CreateBy = "cc",
                Action   = pa,
                Module   = pa,
                LogInfo  = context.Exception.Message,
                Ip       = context.HttpContext.Request.Host.Value
            };

            this._mediator.Send <AddErrorLogCommand>(log);
        }