Feb 20, 2019 04:26 PM|ThomasArdal|LINK
I wouldn't write code for this if I were you. There are a lot of both free and commercial products out there, that will help you store all exceptions happening in your API. The most known free one is
ELMAH, which stores errors locally in a file, memory, database or what ever output you prefer. Here is an
ELMAH tutorial that I wrote to help you get started. Also, I'm the founder of the commercial product elmah.io, which help you store all exceptions in the cloud and much more.
There are a lot of other options out there too, like Stackify and Raygun.