Ejemplo n.º 1
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            try
            {
                var treeId = HttpContext.Current.Items[VariableName.ContextKey].ToString();
                CallContext.LogicalSetData(VariableName.ContextKey, treeId);
                filterContext.HttpContext.Items[VariableName.StopwatchKey] = Stopwatch.StartNew();

                var actionName = string.Format("{0}/{1}", filterContext.ActionDescriptor.ControllerDescriptor.ControllerName,
                                               filterContext.ActionDescriptor.ActionName);
                var ip       = HttpContextHelper.GetIpAddress().PadRight(12, ' ');
                var httpType = HttpContextHelper.GetRequestType().PadRight(5, ' ');
                var msg      = string.Format("[{1}]:{3}{2} {0}{4}", actionName, treeId
                                             , ip, httpType, filterContext.ActionParameters.ToJson());
                _log.Debug(msg);
            }
            catch (Exception ex)
            {
                _log.Error(ex);
            }
        }