Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我将 ELMAH 用于 ASP.Net Web 应用程序,它工作正常
但我需要记录处理的异常而不是手动记录,我不想写在
try/catch 阻止任何代码以使用 ELMAH 记录异常
有什么方法可以定制解决方案来记录代码中处理的异常
埃尔玛
多谢
在这种情况下可以做的最好的事情是,在每个 catch 块中,像这样重新抛出异常
try { ............. } catch(Exception ex) { ............ throw; }
Elmah 会将 catch 块引发的异常作为未处理的异常处理,并自动记录它。