How to ignore caught exceptions in ASP.NET Core?

Sentry will log anything that goes unhandled, but also what you capture explicitly with SentrySdk.CaptureException. Additionally, it has logging integrations. With ASP.NET Core it automatically captures any LogError and LogCritical as events. And any LogWarning and LogInformation are included as breadcrumbs, to any events captured for a particular web request.

It sounds to me that you’re handling an exception and calling LogError in the catch blog. You can stop the SDK from capturing those in a few different ways: Add a BeforeSend callback to filter events based on some of its properties:

For example a property to use is the SDK name, that has the value sentry.dotnet.extensions.logging.

Another, simpler alternative is to raise the minimum level required for the integration to capture an event. By default it’s Error but you could raise to Critical. So only if you’re calling LogCritical it’ll send an event to Sentry.

You can add that to appsettings.json:

{
  "Sentry": {
    "MinimumEventLevel": "Critical",
  }
}