Skip to content

Document that the logging integrations no longer initialize the SDK in v7.0.0 #5706

Open
getsentry/sentry-docs
#19961

Description

@jamescrosswell

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, UseSentry or 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_DSN or 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): SentrySerilogOptions keeps only sink settings. InitializeSdk and WriteTo.Sentry(dsn, …) are gone. ApplySerilogScopeToEvents() is now UseSerilog(), called on the options passed to SentrySdk.Init; it copies Serilog LogContext properties 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, shutdownTimeoutSeconds and flushTimeoutSeconds target attributes are gone, as is setting SentryOptions properties through <options>. When NLog flushes the target, the SDK flushes with SentryOptions.FlushTimeout, which defaults to 2 seconds instead of the target's old 15. SDK diagnostics no longer go to NLog's InternalLogger.
  • log4net (feat(log4net)!: the Sentry appender no longer initializes the SDK #5592): SentryAppender.Environment is 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): SentryLoggingOptions keeps only MinimumEventLevel, MinimumBreadcrumbLevel and log entry filters. Logging:Sentry binds only those and MEL's LogLevel rules, and any other key there fails at startup. Core settings go in the Sentry section. SentryLoggingOptions.ConfigureScope is gone; call SentrySdk.ConfigureScope instead.

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 set o.Dsn and "dsn" in appsettings.json, and the InitializeSdk option. Document UseSerilog(), which no page mentions today.

  • docs/platforms/dotnet/guides/nlog/index.mdx: the "provide it with the DSN" snippet, the NLog.config example with dsn and environment, and the InitializeSdk option.

  • docs/platforms/dotnet/guides/nlog/configuration/advanced-configuration-example.mdx: the dsn, environment, release and shutdownTimeoutSeconds attributes, and o.Dsn and o.ShutdownTimeoutSeconds in the C# and F# tabs.

  • The NLog variants of shared pages, which all put dsn on the target:

    • platform-includes/configuration/config-intro/dotnet.nlog.mdx
    • platform-includes/set-environment/dotnet.nlog.mdx (also sets environment)
    • platform-includes/set-release/dotnet.nlog.mdx (also sets release)
    • platform-includes/enriching-events/set-tag/dotnet.nlog.mdx
    • platform-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: the appsettings.json example with Dsn under Logging:Sentry, AddSentry(o => o.Dsn = …) in the ILoggerFactory example, and the "Options and Initialization" section with InitializeSdk. 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 says SentryAspNetCoreOptions extends Sentry.Extensions.Logging.SentryLoggingOptions, which extends SentryOptions. Since feat(mel)!: the Microsoft.Extensions.Logging integration no longer initializes the SDK #5595 it extends SentryHostOptions, which extends SentryOptions, and SentryLoggingOptions no longer derives from SentryOptions. 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 move SentryHostOptions to 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

  1. linear-code commented on Oct 12, 2026

    @linear-code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions