-
-
Notifications
You must be signed in to change notification settings - Fork 226
fix(logs): minimum Log-Level for Structured Logs #4700
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4700 +/- ##
==========================================
+ Coverage 73.85% 73.91% +0.05%
==========================================
Files 485 485
Lines 17689 17686 -3
Branches 3497 3494 -3
==========================================
+ Hits 13065 13072 +7
+ Misses 3762 3756 -6
+ Partials 862 858 -4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@sentry review |
|
@Flash0ver do you think this is going into an RC3 ? Thanks |
|
@ericsampson, actually, this will be in |
Fixes #4539
Fixes #4734
Summary
Previously, the Logging-Configuration was inconsistent between SDKs (M.E.L, ASP.NET Core, MAUI, Google-Cloud-Functions):
This changeset is normalizing the applied Logging-Filter-Rules across all integrations:
Logging-Configuration (i.e.
Logging:LogLevel:DefaultandLogging:Sentry:LogLevel:Defaultvia e.g.appsettings.json) is now respected for Structured Logs, but now ignored for Breadcrumbs and Events, since we have existingMinimumBreadcrumbLevelandMinimumEventLevel, as well asAddLogEntryFilterextension methods for filtering Breadcrumbs and Events.New
Sentry.Google.Cloud.Functionsnow supports Structured LogsEnableLogs = trueChanged
SentryLoggingOptions.ExperimentalLogging.MinimumLogLevelfor Structured-Logs"Sentry"logging provider nameappsettings.json) now only applies to Structured Loggingappsettings.json) no longer applies to BreadcrumbsSentryLoggingOptions.MinimumBreadcrumbLevelandSentryLoggingOptionsExtensions.AddLogEntryFilterappsettings.json) no longer applies to EventsSentryLoggingOptions.MinimumEventLevelandSentryLoggingOptionsExtensions.AddLogEntryFilterILoggerProviderandIConfigureOptionsinternalLoggerFilterRules are correctly setsentry-docsSentryStructuredLoggerProvider(and derived for ASP.NET Core and MAUI) now have[ProviderAlias("Sentry")]appsettings.jsonconfiguration for Structured LogsTesting
Microsoft.Extensions.Logging.LoggerFilterRule)SentryLoggerProvider(and derived) is NOT configurable viaappsettings.json(for Breadcrumbs and Events)LoggerFilterRule.FilterSentryStructuredLoggerProvider(and derived) IS configurable viaappsettings.json(via the"Sentry"logging provider name)LoggerFilterRule.FilterbeingnullILoggerProviderfor Breadcrumbs/Events and theILoggerProviderfor Structured LogsSamples
appsettings.jsonof these samples to show how to configure Structured Logs, in contrast to Breadcrumbs and EventsSentry.Samples.AspNetCore.BasicSentry.Samples.GenericHostSentry.Samples.Google.Cloud.FunctionsImportant
This functionality relies on a quirk/feature of
Microsoft.Extensions.Logging.LoggerFilterRule. When a filter delegate is configured, filtering via configuration bindings are ignored and only the filtering delegate is applied. When not using a filter delegate, log filtering from configuration bindings does get applied.