2021年1月4日星期一

Preventing specific exceptions from being logged to App Insights

This is a long shot and there doesnt seem to be anything close on Google, but I was wondering if it possible to prevent certain exceptions from being logged to App Insights?

There are a lot of places in our code base where exceptions were raised for user actions that are not really exceptions that we want to show in App Insights.

However, changing all the areas where this occurs would take use a long time and would require a lot of testing as we would need to make sure that the flow of logic is not changed

At the moment we raise exceptions of type LocationDomainException, Im thinking that if I come across somewhere where we dont want to log the exception, we can change to LocationDomainUserError

I would need to stop this exception, or any exception inheriting from it from being logged

Im using .NET Core 3.1.

I appreciate this is a bit of an anti pattern, but has anyone ever tried it?

https://stackoverflow.com/questions/65568843/preventing-specific-exceptions-from-being-logged-to-app-insights January 05, 2021 at 03:43AM

没有评论:

发表评论