Repository navigation
Closed
getsentry/sentry-docs
#19925Labels
.NETPull requests that update .net codeDocsLogsNext MajorChanges scheduled for the next Major release.
Description
Follow-up to #5183. #5642 and #5676 changed how .NET apps turn on logs in 7.0.0, and the docs still describe 6.x. #5642 said the docs would come in a separate sentry-docs PR, and nobody has opened it yet.
The .NET docs aren't versioned. As with #5546, the new text should say that it applies from 7.0.0 on, or the PR should merge when 7.0.0 ships.
What changed in 7.0.0
- feat!: EnableLogs moves from SentryOptions to ASP.NET Core, MAUI and Blazor, where logs are opt-in removed
SentryOptions.EnableLogs.SentrySdk.Loggernever needed it, and the logging integrations no longer read it. - Serilog, NLog and log4net send logs as soon as the app adds the integration. feat(serilog)!: the Sentry sink no longer initializes the SDK removed Serilog's
enableLogsparameter. NLog keepsSentryTarget.EnableLogsas an obsolete property that does nothing, and fix(nlog): report a leftover enableLogs="false" makes it write a warning to stderr when an app sets it tofalse. Logging.AddSentry()sends logs without a switch when the app callsSentrySdk.Inititself.- ASP.NET Core, Google Cloud Functions, MAUI and Blazor WebAssembly add the
ILoggerprovider for the app, so installing them doesn't turn logs on.EnableLogslives onSentryAspNetCoreOptions,SentryMauiOptionsandSentryBlazorOptionsand defaults tofalse, as in 6.x. Apps set it in code or in theSentryconfiguration section. - In those host apps, an extra
builder.Logging.AddSentry()call doesn't turn logs on. The host'sEnableLogsdecides. Since fix!: apps that call both UseSentry and Logging.AddSentry() no longer capture each error, breadcrumb and log twice #5694 the call adds nothing at all: the host already registers Sentry's logger providers, and options passed toAddSentry(o => …)in code are ignored. - Since feat(mel)!: the Microsoft.Extensions.Logging integration no longer initializes the SDK, an app that sets
EnableLogsunderLogging:Sentryfails at startup with aNotSupportedException. The setting belongs in theSentrysection.
Pages to update in getsentry/sentry-docs
platform-includes/logs/setup/dotnet.mdxsetsEnableLogsin theSentrySdk.Init,Logging.AddSentry(), Serilog, NLog and log4net snippets. Remove it from those snippets and their notes, including theappsettings.jsonexample forMicrosoft.Extensions.Logging. Keep it for ASP.NET Core, AWS Lambda, Blazor WebAssembly and MAUI.platform-includes/logs/options/dotnet.mdxshould describeEnableLogsas a setting of the host integrations only.- The Serilog, NLog and log4net guide pages say that log messages go to Sentry "when enabled". Say instead that adding the integration is enough.
docs/platforms/dotnet/guides/blazor-webassembly/index.mdx: the setup snippet callsbuilder.Logging.AddSentry(o => o.InitializeSdk = false)afterUseSentry. In 7.0.0 that line doesn't compile, becauseInitializeSdkis obsolete as an error since feat(mel)!: the Microsoft.Extensions.Logging integration no longer initializes the SDK, and it adds nothing since fix!: apps that call both UseSentry and Logging.AddSentry() no longer capture each error, breadcrumb and log twice. Remove it. The Blazor WebAssembly sample already calls onlyUseSentry.docs/platforms/dotnet/guides/azure-functions-worker/index.mdx: the snippet initializes the SDK throughlogging.AddSentry(options => { options.Dsn = ...; ... }). The logging integration no longer initializes the SDK in 7.0.0 (getsentry/sentry-dotnet#5245), so those options move to aSentrySdk.Initcall andlogging.AddSentry()takes none. TheSentry.Samples.OpenTelemetry.AzureFunctionssample onversion7already does this.docs/platforms/dotnet/common/migration/index.mdxhas no 7.x section yet. Its breaking changes should list the removal ofSentryOptions.EnableLogsand of Serilog'senableLogsparameter.platform-includes/metrics/options/dotnet.mdxsaysEnableMetrics"is obsolete and ignored since version 6.10.0, and will be removed in version 7.0.0". feat!: remove SentryOptions.EnableMetrics #5690 removed it, so from 7.0.0 the entry should say it was removed, and keep the advice to returnnullfromSetBeforeSendMetricto drop metrics.
Also cover
- An ASP.NET Core app that also uses the Serilog sink sends each log twice when
EnableLogsis on, once from each provider. - The Serilog and NLog snippets on the setup page also pass a DSN to the integration. Don't initialise the Sdk from logging integrations #5245 stopped the logging integrations from initializing the SDK in 7.0.0, so those snippets need a
SentrySdk.Initcall in any case.
Metadata
Metadata
Assignees
Labels
.NETPull requests that update .net codeDocsLogsNext MajorChanges scheduled for the next Major release.
Activity
linear-code commentedon Oct 8, 2026
NET-852
[-]Document the logs opt-in changes for v7.0.0[/-][+]Document the logging changes for v7.0.0[/+]docs(dotnet): Update logging docs for SDK 7.0.0 (#19925)