[英]e.Dismiss() does not work in ErrorLog_Filtering method in Global.asax.cs
I am trying to stop errors from reaching my error collection but I am unable to. 我试图阻止错误到达我的错误集合,但我无法这样做。
public void ErrorLog_Filtering(object sender, ExceptionFilterEventArgs e)
{
e.Dismiss();
}
The errors still reach my error collection and I don't know why. 错误仍然到达我的错误集合,我不知道为什么。 I placed breakpoints and the method works, e.Dismiss() gets called. 我放置了断点,该方法有效,调用了e.Dismiss()。 Any ideas? 有任何想法吗? I'm all out. 我全力以赴。
I found out what was happening. 我发现发生了什么事。 Someone else added a global filter that was handling the exceptions and logging them to the error collection. 其他人添加了一个全局过滤器,用于处理异常并将它们记录到错误收集中。
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new LogExceptionFilter());
}
and inside the LogExceptionFilter: 在LogExceptionFilter内部:
public class LogExceptionFilter : IExceptionFilter
{
public void OnException(ExceptionContext context)
{
_log.Error(context.Exception);
}
private readonly ILog _log = LogManager.Instance.GetLogger();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.