【问题标题】:Does the filter context contain Source Error or Source File?过滤器上下文是否包含源错误或源文件?
【发布时间】:2014-10-20 10:58:08
【问题描述】:

我创建了一个自定义错误处理程序,我希望记录源文件和源错误,但我的研究都没有告诉我这是否可能。

有谁知道 filterContext 是否会给我这个信息,或者是否有其他方法可以获取我想要的信息?

感谢您的帮助。

【问题讨论】:

    标签: c# error-handling error-logging


    【解决方案1】:

    根据我的经验,这是不可能的,但您应该通过记录堆栈跟踪来获取所需的所有信息。

    试试:

    public override void OnException(ExceptionContext filterContext)
    {
        ErrorLog errorLog = new ErrorLog();
        errorLog.ExeptionStackTrace = filterContext.Exception.StackTrace;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-06-04
      • 1970-01-01
      • 1970-01-01
      • 2019-12-16
      • 1970-01-01
      • 1970-01-01
      • 2011-03-25
      • 2011-07-11
      相关资源
      最近更新 更多