Repository navigation
Document that the logging integrations no longer initialize the SDK in v7.0.0 #5706
Description
Companion to #5698. #5245 stopped the four logging integrations from initializing the SDK in 7.0.0 (#5573, #5585, #5592, #5595). #5698 covers the logs pages. The integration guides themselves still tell users to initialize Sentry through the integration, and their snippets stop working on 7.0.0.
The .NET docs aren't versioned. As with #5546 and #5698, 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
- Every logging integration needs Sentry initialized first, with
SentrySdk.Init,UseSentryor another host integration. The integration then only sends what it captures. - The 6.x entry points that took a DSN are kept as tombstones. In code they are obsolete as errors. In configuration files, Serilog and NLog fail to load with a migration message, and log4net logs the message but still loads the appender.
- An integration configured without a DSN used to initialize the SDK from
SENTRY_DSNor a[Dsn]attribute. Now, if Sentry isn't initialized but a DSN can be found, it writes one line to standard error the first time it drops an event. - Serilog (feat(serilog)!: the Sentry sink no longer initializes the SDK #5573):
SentrySerilogOptionskeeps only sink settings.InitializeSdkandWriteTo.Sentry(dsn, …)are gone.ApplySerilogScopeToEvents()is nowUseSerilog(), called on the options passed toSentrySdk.Init; it copies SerilogLogContextproperties onto events.Log.CloseAndFlush()no longer disposes the SDK. - NLog (feat(nlog)!: the Sentry target no longer initializes the SDK #5585): the
dsn,release,environment,initializeSdk,shutdownTimeoutSecondsandflushTimeoutSecondstarget attributes are gone, as is settingSentryOptionsproperties through<options>. When NLog flushes the target, the SDK flushes withSentryOptions.FlushTimeout, which defaults to 2 seconds instead of the target's old 15. SDK diagnostics no longer go to NLog'sInternalLogger. - log4net (feat(log4net)!: the Sentry appender no longer initializes the SDK #5592):
SentryAppender.Environmentis gone. Closing the log4net repository no longer flushes Sentry. - Microsoft.Extensions.Logging (feat(mel)!: the Microsoft.Extensions.Logging integration no longer initializes the SDK #5595):
SentryLoggingOptionskeeps onlyMinimumEventLevel,MinimumBreadcrumbLeveland log entry filters.Logging:Sentrybinds only those and MEL'sLogLevelrules, and any other key there fails at startup. Core settings go in theSentrysection.SentryLoggingOptions.ConfigureScopeis gone; callSentrySdk.ConfigureScopeinstead.
The PR descriptions above have before/after snippets for each integration.
Pages to update in getsentry/sentry-docs
-
docs/platforms/dotnet/guides/serilog/index.mdx: the paragraph "It's also possible to initialize the SDK through the Serilog integration", the snippets that seto.Dsnand"dsn"inappsettings.json, and theInitializeSdkoption. DocumentUseSerilog(), which no page mentions today. -
docs/platforms/dotnet/guides/nlog/index.mdx: the "provide it with the DSN" snippet, theNLog.configexample withdsnandenvironment, and theInitializeSdkoption. -
docs/platforms/dotnet/guides/nlog/configuration/advanced-configuration-example.mdx: thedsn,environment,releaseandshutdownTimeoutSecondsattributes, ando.Dsnando.ShutdownTimeoutSecondsin the C# and F# tabs. -
The NLog variants of shared pages, which all put
dsnon the target:platform-includes/configuration/config-intro/dotnet.nlog.mdxplatform-includes/set-environment/dotnet.nlog.mdx(also setsenvironment)platform-includes/set-release/dotnet.nlog.mdx(also setsrelease)platform-includes/enriching-events/set-tag/dotnet.nlog.mdxplatform-includes/enriching-events/set-user/dotnet.nlog.mdx
Release and environment can no longer be set on the target, so the set-environment and set-release variants can probably be deleted, letting the NLog guide use the generic .NET versions.
-
docs/platforms/dotnet/guides/log4net/index.mdx: the<Dsn>element in the appender configuration and the "DSN" section, which says the DSN makes the appender initialize the SDK. -
docs/platforms/dotnet/guides/extensions-logging/index.mdx: theappsettings.jsonexample withDsnunderLogging:Sentry,AddSentry(o => o.Dsn = …)in theILoggerFactoryexample, and the "Options and Initialization" section withInitializeSdk. Generic-host apps lose their init path on this page; Document how to initialize Sentry in generic host apps for v7.0.0 #5707 covers documenting its replacement from Add a non-logging way to initialise Sentry in generic host apps #5572. -
docs/platforms/dotnet/guides/aspnetcore/index.mdx, under "Configure": it saysSentryAspNetCoreOptionsextendsSentry.Extensions.Logging.SentryLoggingOptions, which extendsSentryOptions. Since feat(mel)!: the Microsoft.Extensions.Logging integration no longer initializes the SDK #5595 it extendsSentryHostOptions, which extendsSentryOptions, andSentryLoggingOptionsno longer derives fromSentryOptions. This doesn't depend on Add a non-logging way to initialise Sentry in generic host apps #5572 and can go in docs(dotnet): Update logging docs for SDK 7.0.0 sentry-docs#19925, which merges at 7.0.0 GA. Add a non-logging way to initialise Sentry in generic host apps #5572 may moveSentryHostOptionsto another package, so check its namespace before merging.
Each page should initialize Sentry first (or point at the host integration), then add the integration. It should also mention the standard-error warning, so a user who sees it knows what to change.
Related: #3081 asks for better docs for the Microsoft.Extensions.Logging integration.
Activity
linear-code commentedon Oct 12, 2026
NET-856