elmah 也处理捕获的异常吗
ELMAH 是否记录异常,即使它们没有冒泡到应用程序? 我想在发生异常时弹出一条消息并仍然记录异常。 目前,我已经将所有内容放入 try catch 块中并吐出消息,但这变得很乏味。
Does ELMAH logged exceptions even when they do not bubble up to the application? I'd like to pop up a message when an exception occurs and still log the exception. Currently I've been putting everything in try catch blocks and spitting out messages, but this gets tedious.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
过滤器是解决这个问题最干净的方法。 在此处查看此解决方案https://stackoverflow.com/a/5936867/965935
A filter is the cleanest way to handle this problem. Check this solution here https://stackoverflow.com/a/5936867/965935
ELMAH 已更新,支持名为信令的新功能。
这允许您按照自己的意愿处理异常,同时仍将它们记录到 ELMAH。
重新抛出异常可能是一种不好的做法,因为它使得跟踪应用程序的流程变得困难。 如果您打算以某种方式处理错误并且只是想记录它,那么使用信令是一种更好的方法。
请查看 ELMAH 上的 DotNetSlackers 撰写的这份出色指南
ELMAH has been updated to support a new feature called Signaling.
This allows you to handle exceptions how you want, while still logging them to ELMAH.
Re-throwing exceptions can be a bad practice as it makes it difficult to trace the flow of an application. Using Signaling is a much better approach if you intended to handle the error in some fashion and simply want to document it.
Please check out this excellent guide by DotNetSlackers on ELMAH