Skip to content

Sentry Logging should respect the user's global ILogger filter(s). #4734

@ericsampson

Description

@ericsampson

Package

Sentry

.NET Flavor

.NET

.NET Version

9.0.200

OS

Any (not platform specific)

OS Version

No response

Development Environment

Rider 2024 (MacOS)

SDK Version

5.16.3

Self-Hosted Sentry Version

No response

Workload Versions

NA

UseSentry or SentrySdk.Init call

            builder.ConfigureWebHostDefaults(webBuilder =>
            {
                webBuilder.ConfigureLogging(logging =>
                {
                    logging.AddFilter("Microsoft", LogLevel.Warning);
                });
                webBuilder.UseSentry(sentry =>
                {
                    sentry.Dsn = SentryHelper.Dsn;
                    sentry.SendDefaultPii = true;
                    sentry.CaptureFailedRequests = true;
                    sentry.EnableBackpressureHandling = true;
                    sentry.Experimental.EnableLogs = true;

Steps to Reproduce

Run the API

Expected Result

Logs having the category Microsoft.* and level < Warning are not sent to Sentry.

Actual Result

I was unpleasantly surprised to see that ALL logs of category Microsoft.* were sent to Sentry, which was a huge volume.

This violates the principle of "least surprise", and does not follow the framework conventions:
How filtering rules are applied

Metadata

Metadata

Assignees

Labels

.NETPull requests that update .net codeBugSomething isn't workingLogs

Projects

Status

Done

Status

Waiting for: Product Owner

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions