How do I log ALL exceptions globally for a C# MVC4 WebAPI app?

后端 未结 5 1703
失恋的感觉
失恋的感觉 2020-11-30 16:31

Background

I am developing an API Service Layer for a client and I have been requested to catch and log all errors globally.

So, while something like an un

5条回答
  •  庸人自扰
    2020-11-30 17:03

    Wrap the whole thing in a try/catch and log the unhandled exception, then pass it on. Unless there's a better built-in way to do it.

    Here's a reference Catch All (handled or unhandled) Exceptions

    (edit: oh API)

提交回复
热议问题