ASP.NET Exception Handling/Logging

后端 未结 7 900
感动是毒
感动是毒 2020-12-20 20:31

Is there an easy way to log all exceptions in an ASP.NET application? I\'m already logging unhandled exceptions through the Application_OnError event, but I want to perform

7条回答
  •  轮回少年
    2020-12-20 20:56

    I agree with Collin, that you should log wherever you catch (and don't rethrow).

    But if you need that every exception logged without much code modifications, then handle the AppDomain.FirstChanceException Event, and you'll get ALL the exceptions (maybe that's even too much :p, but it could help you clean the code).

提交回复
热议问题