Skip to content

docs(dotnet): Update logging docs for SDK 7.0.0 - #19925

Merged
jamescrosswell merged 16 commits into
dotnet-v7from
dotnet-v7-logging
Nov 11, 2026
Merged

jamescrosswell merged 16 commits into
dotnet-v7from
dotnet-v7-logging

Conversation

@jamescrosswell

@jamescrosswell jamescrosswell commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

Note

This targets dotnet-v7, which collects the .NET docs for sentry-dotnet 7.0.0. #20641 merges that branch into master when 7.0.0 ships, so this PR can merge into dotnet-v7 as soon as it's approved.

DESCRIBE YOUR PR

Updates the .NET logging docs for sentry-dotnet 7.0.0. In 7.0.0, SentryOptions.EnableLogs and SentryOptions.EnableMetrics are removed, Serilog, NLog and log4net send logs as soon as they're added, and the Serilog, NLog, log4net and Microsoft.Extensions.Logging integrations no longer initialize the SDK. The pages are written for 7.x. The docs aren't versioned, so this goes live with the rest of the 7.0.0 docs.

  • Logs setup, options and usage (platform-includes/logs/*/dotnet.mdx): EnableLogs is only documented on the host options (ASP.NET Core, AWS Lambda, Azure Functions, Blazor Server, Blazor WebAssembly, MAUI). The Serilog, NLog, log4net and Microsoft.Extensions.Logging snippets call SentrySdk.Init and add the integration without a switch. The host and Serilog/NLog/log4net sections explain when EnableLogs sends each log twice.
  • Serilog, NLog and log4net guides: initialize Sentry first, then add the sink/target/appender. Removed initializing through the integration, InitializeSdk, and the DSN, environment, release and <options> settings on the NLog target and log4net appender. Documented Serilog's UseSerilog() and the one-time standard-error warning.
  • NLog includes: removed dsn from the set-tag and set-user variants, including the options.Dsn that feat(docs): Apply new quick start template to .NET quick start guides #19990 added to the set-tag snippet. Deleted the set-environment, set-release and config-intro variants, so the NLog guide uses the generic .NET pages, which set these on the options passed to SentrySdk.Init.
  • Blazor WebAssembly: removed builder.Logging.AddSentry(o => o.InitializeSdk = false), which no longer compiles and was already redundant with UseSentry.
  • Azure Functions: installs Sentry.Extensions.Hosting instead of Sentry.Extensions.Logging, and starts Sentry with .UseSentry(options => ...) on the HostBuilder chain instead of logging.AddSentry(options => ...). EnableLogs = true stays in the snippet, now on SentryGenericHostOptions. Apps with the ASP.NET Core integration (ConfigureFunctionsWebApplication()) call the same UseSentry. The "Changed in Version 7.0.0" alert covers 6.x, which has no hosting package.
  • ASP.NET: removed EnableLogs from the SentrySdk.Init snippet and from the list of features the snippet turns on. Send Logs now says the Serilog, NLog and log4net integrations send logs as soon as they're added, and points to SetBeforeSendLog for dropping them.
  • Metrics options: EnableMetrics was removed in 7.0.0. Kept the advice to return null from SetBeforeSendMetric.

Closes getsentry/sentry-dotnet#5698
Part of getsentry/sentry-dotnet#5706

Notes for review

  • The Serilog, NLog and log4net guides each have a new "Capturing Startup Crashes" subsection for apps that want crashes from before UseSentry starts Sentry (Document capturing ASP.NET Core startup crashes with Serilog, NLog and log4net in v7.0.0 sentry-dotnet#5844). Each calls SentrySdk.Init before the builder; the Serilog one does it alongside Serilog's two-stage initialization. The companion samples, docs(samples): capture startup crashes in the ASP.NET Core Serilog sample sentry-dotnet#5847 and docs(samples): capture startup crashes in the ASP.NET Core NLog sample sentry-dotnet#5866, link to them.
  • Merged master after feat(docs): Apply new quick start template to .NET quick start guides #19990, which moved the .NET guides to the new quick start template. The Azure Functions and Blazor WebAssembly changes now sit on that template, which already uses UseOtlp() for Azure Functions.
  • The Microsoft.Extensions.Logging snippet on the logs setup page uses SentrySdk.Init plus builder.Logging.AddSentry(), and says in one sentence that generic-host apps use UseSentry from Sentry.Extensions.Hosting instead. The Microsoft.Extensions.Logging guide page is updated in docs(dotnet): Update Microsoft.Extensions.Logging guide for SDK 7.0.0 #19961, so this PR only partly covers delete hidden DS pages #5706.
  • Azure Functions follows feat: add Sentry.Extensions.Hosting with UseSentry for generic host apps sentry-dotnet#5739. It adds Sentry.Extensions.Hosting with UseSentry, and says Azure Functions (isolated) apps use it, also with the ASP.NET Core integration. Checked against version7: SentryGenericHostOptions.EnableLogs defaults to false, and UseSentry registers Sentry's ILogger providers. ConfigureFunctionsWorkerDefaults() and ConfigureFunctionsWebApplication() return IHostBuilder, so the snippet binds to UseSentry(IHostBuilder, Action<SentryGenericHostOptions>). The SDK starts in Build() and closes when the host stops. The version7 sample makes the same call. feat(mel)!: Logging.AddSentry() no longer registers IHub or ISentryClient sentry-dotnet#5740 stops Logging.AddSentry() from registering IHub, so UseSentry is now also what puts it in DI.
  • The logs setup and options includes list dotnet.extensions-hosting in the UseSentry + EnableLogs sections, the appsettings.json tab and the Serilog/NLog/log4net expandables. That's the platform key of the generic-host guide coming in a separate PR, so that PR doesn't need to edit these files. Nothing links to it yet, since the page doesn't exist on this branch. Azure Functions isn't in the Serilog/NLog/log4net expandables: their snippets use builder.Services and builder.Logging, which a HostBuilder chain doesn't have.
  • "Before 7.0.0" notes appear only where a 6.x reader following the page would silently get no logs, or replace their SDK setup: the Serilog/NLog/log4net and Microsoft.Extensions.Logging sections of the logs setup page, the EnableLogs option, and the Azure Functions guide.
  • feat(discover-homepage): Update Discover homepage docs for GA #5698 says an ASP.NET Core app that also uses the Serilog sink sends each log twice with EnableLogs on. That only happens when ILogger entries reach both Sentry's provider and Serilog. I checked against version7: one LogInformation call was sent once with builder.Host.UseSerilog(), which replaces the logger factory, and twice with builder.Logging.AddSerilog(). The same applies to NLog and log4net when they're registered as ILogger providers. So the docs name that case, registering the framework as an ILogger provider (for example builder.Logging.AddSerilog()), and say to leave EnableLogs off then.
  • delete hidden DS pages #5706 describes UseSerilog() as the replacement for ApplySerilogScopeToEvents(). On version7 it's optional: if the app doesn't call it, the sink registers the scope processor itself once it's running, so only events captured before then miss the LogContext properties. The guide says so.
  • Changes beyond the two issues:
    • dotnet.blazor-server added to the EnableLogs sections. It uses Sentry.AspNetCore's UseSentry, but it fell into the plain SentrySdk.Init section, which now says logging integrations need no switch.
    • log4net logs usage no longer mentions SentryAppender.Environment, which 7.0.0 removes (feat(log4net)!: the Sentry appender no longer initializes the SDK sentry-dotnet#5592).
    • The NLog set-user snippet used new User. That type doesn't exist, so it's now SentryUser.
  • The Azure Functions snippet drops TracesSampleRate and DisableSentryHttpMessageHandler, which the version7 sample still sets. Under UseOtlp() Sentry creates no transactions of its own, so TracesSampleRate has no effect. SentryHttpMessageHandler already skips span creation, so disabling it would only stop it propagating sentry-trace. docs(dotnet): Update OTLP propagation docs for SDK 7.0.0 #19924 documents both.
  • The C# and F# snippets I added or changed compile against the version7 sources. The Azure Functions and UseSentry ones compile against the 7.0.0-rc.2 packages, whose public API matches version7.

IS YOUR CHANGE URGENT?

Help us prioritize incoming PRs by letting us know when the change needs to go live.
Select exactly one option. For deadlines, replace YYYY-MM-DD with the due date. You can update this information later by editing the PR description.

  • Urgent deadline (GA date, etc.): 2026-11-30
  • Other deadline: YYYY-MM-DD
  • No deadline: Not urgent, can wait up to 1 week+

🤖 Generated with Claude Code

In sentry-dotnet 7.0.0, SentryOptions.EnableLogs and EnableMetrics are
removed, and the Serilog, NLog, log4net and Microsoft.Extensions.Logging
integrations no longer initialize the SDK. Initialize Sentry with
SentrySdk.Init or a host integration first, then add the integration.
Serilog, NLog and log4net send logs without a switch; EnableLogs stays
only on the ASP.NET Core, MAUI and Blazor WebAssembly options.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
sentry-docs Ready Ready Preview Nov 11, 2026 3:10am UTC
1 Skipped Deployment
Project Deployment Actions Updated
develop-docs Ignored Ignored Preview Nov 11, 2026 3:10am UTC

Request Review

UseOpenTelemetry() and TracerProviderBuilder.AddSentry() have been
obsolete since 6.12.0. Use UseOtlp() and AddSentryOtlpExporter from
Sentry.OpenTelemetry.Exporter, as the version7 sample does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It happens only when Serilog, NLog or log4net is also registered as an
ILogger provider, so name that case instead of "ILogger entries also go
to" the framework.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: James Crosswell <jamescrosswell@users.noreply.github.com>
@cursor

cursor Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

This change rewrites logging setup pages for a new SDK major. Readers now see Init-first examples. Three logging frameworks send logs without a flag.

The plan checks page loads, client errors, and RSC fetch failures on those paths. An issue escalates when those pages stop loading or those errors rise.

Services: sentry-docs.

Mention @change-monitor in a comment to update the plan.

Plan

What changed

.NET logging pages now tell readers to call SentrySdk.Init first. Serilog, NLog, and log4net send logs as soon as they are added. EnableLogs stays only for ILogger on some hosts. Azure Functions docs no longer initialize the SDK inside AddSentry. Blazor WebAssembly docs drop the extra AddSentry call.

sentry-docs must deploy before this copy is live. The Vercel production project maps to that service. develop-docs does not ship these paths.

Risk

Wrong copy can make readers skip Init or send each log twice. A PlatformSection mistake can show the wrong snippet on sibling logs pages. Removed NLog includes fall back to generic environment and release copy. A failed MDX render can hide Azure Functions or Blazor setup. The shared logs includes also ship to every .NET logs page.

Intended effect

Telemetry cannot show that the new 7.0.0 wording is live. The executor cannot mark intended_effect from metrics. Inspect the live logging pages if a human check is required.

absent would be the live pages still showing EnableLogs on Serilog, NLog, and log4net. That case stays unknown from telemetry.

Regression watch

This diff can break render of the changed guides and every .NET logs page that pulls the shared includes. Watch client errors and RSC fetch failures first. Those are the symptoms users and on-call would see. Then watch not-found and page-load share so a silent blank path is not missed.

Signal Baseline Rule Source
Client errors on /platforms/dotnet pages 8 events in 2026-10-12T04:09:00Z to 2026-10-13T04:09:00Z. Hourly band 0-3. Peak 3 at 2026-10-12T22:00Z. About 1.9 events per 100 page loads, from 8 events against 431 page loads. Titles were TypeError on mw, promise rejection, and an Algolia NetworkError. Hold the hourly band at 0-3. Escalate if the next 24h count rises above 8 while page loads hold. Treat one Algolia or mw event as noise. Sentry org sentry, project docs. Query: environment:production (http.url:*/platforms/dotnet* OR transaction:*/platforms/dotnet*)
RSC fetch failure logs that mention platforms/dotnet 11 matching logs in 2026-10-12T04:09:00Z to 2026-10-13T04:09:00Z. Site-wide RSC fetch failures were 923 in the same window. Hold the .NET slice near 11 per 24h. Escalate if that slice rises while the site-wide count stays near 923. Sentry org sentry, project docs. Query: sentry.environment:production message:"*Failed to fetch RSC payload*" message:"*platforms/dotnet*"
docs.page.not_found for platforms/dotnet 2 counts in 2026-10-12T04:09:00Z to 2026-10-13T04:09:00Z. That is about 0.5 not-found per 100 page loads. Hold 0-2 per 24h. Escalate if the count rises while other platform not-found stays near 19 for platforms/javascript. Sentry org sentry, project docs. Metric docs.page.not_found. Query: sentry.environment:production requested_path:platforms/dotnet
docs.page.load on /platforms/dotnet 431 loads in 2026-10-12T04:09:00Z to 2026-10-13T04:09:00Z. 5485 loads in 2026-10-06T04:09:00Z to 2026-10-13T04:09:00Z. Share of page_type=platforms loads is 431 of 8792, about 4.9%. Changed-path loads in the 24h window: Serilog 3, log4net 4, Blazor WebAssembly 6, NLog 0, Azure Functions worker 0. .NET logs pages totaled 26. Hold the .NET share near 4.9%. Escalate if the logs-page group falls toward 0 while other platform logs pages still load. NLog and Azure Functions worker had 0 loads, so they cannot show a drop on their own. Sentry org sentry, project docs. Metric docs.page.load. Query: environment:production path:*/platforms/dotnet*

Not observable

The new 7.0.0 wording is not in telemetry. Pageload traces did not match these URL transactions, so latency is not a watch. Reader setup mistakes in downstream apps are not in this project.

ric-oliv pushed a commit that referenced this pull request Oct 13, 2026
## DESCRIBE YOUR PR

Fixes two errors in the NLog docs. Both are accurate for the current 6.x
SDK, so this can merge now.

- **NLog guide options list:** `SendEventPropertiesAsData` and
`SendEventPropertiesAsTags` don't exist. The target's settings are
`IncludeEventProperties`, which NLog's `TargetWithContext` provides and
`SentryTarget` sets to `true`, and `IncludeEventPropertiesAsTags`.
`Layout` was described as "layout for the NLog logger". It's the layout
for the message of events sent to Sentry, and defaults to `${message}`.
- **NLog set-tag example:** the C# and F# tabs set `"${logger}"` on the
scope. Sentry doesn't render NLog layouts there, so the tag value was
the literal string `${logger}`. The tabs now add the tag to the target,
matching the `NLog.config` tab, and a sentence says layouts only work in
target tags.

Closes getsentry/sentry-dotnet#5716

### Notes for review

- I checked the options list against
`src/Sentry.NLog/SentryNLogOptions.cs` and `SentryTarget.cs` on
sentry-dotnet `main`. Only target tags go through `RenderLogEvent`.
Nothing in Sentry.NLog reads scope tags. A run against Sentry.NLog
6.12.0 sent `logger = MyApp.Checkout` for the target tag and
`scope_logger = ${logger}` for the scope tag.
- The list is still not exhaustive. It leaves out `BreadcrumbCategory`,
`Dsn`, `Release`, `Environment`, `EnableLogs`, `ShutdownTimeoutSeconds`
and `FlushTimeoutSeconds`. I didn't add them because 7.0.0 removes most
of them from the target.
- The new code tabs set `options.Dsn` to mirror the `dsn` attribute in
the `NLog.config` tab, since the 6.x target initializes the SDK.
- #19925, which merges at sentry-dotnet 7.0.0 GA,
edits the same two files. It removes `InitializeSdk` from the options
list and `dsn` from the set-tag target, so it will need `master` merged
in later. At that point it should also drop `options.Dsn` from the new
code tabs, because `SentryNLogOptions` no longer has it in 7.0.0.
- The C# and F# snippets compile against Sentry.NLog 6.12.0.

## IS YOUR CHANGE URGENT?

Help us prioritize incoming PRs by letting us know when the change needs
to go live.
Select exactly one option. For deadlines, replace `YYYY-MM-DD` with the
due date. You can update this information later by editing the PR
description.

- [ ] Urgent deadline (GA date, etc.): YYYY-MM-DD
- [ ] Other deadline: YYYY-MM-DD
- [x] No deadline: Not urgent, can wait up to 1 week+

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
As for Serilog: UseSentry starts Sentry when the host is built, so
crashes before then aren't sent. Calling SentrySdk.Init before creating
the builder, and logging the crash if startup fails, sends them.

Refs getsentry/sentry-dotnet#5844

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ric-oliv added a commit that referenced this pull request Nov 4, 2026
…0408)

## DESCRIBE YOUR PR

In 7.0.0 the Serilog sink, NLog target and log4net appender no longer
start Sentry. Apps that set the DSN there and also call `UseSentry` used
to send crashes from before `UseSentry` started Sentry, and now drop
them.

This adds "Logging Integrations No Longer Report Startup Crashes" to the
6.x to 7.x migration guide, as a verify step in the interactive
checklist. It shows the workaround from getsentry/sentry-dotnet#5847:
call `SentrySdk.Init` at the top of `Main` as well, and capture the
crash in a `catch`. Without the `catch`, an app with an async `Main`
still drops the crash, because `using` disposes the first initialization
before the exception reaches the runtime. "Logging Integrations No
Longer Initialize Sentry" says to initialize Sentry once, so it now
links to the new step.

Checked on 7.0.0-rc.3 with a local stand-in for Sentry, crashing after
`UseSentry` but before `Run()`: with the `catch`, a sync and an async
`Main` each send the crash once. Without it, the async one sends
nothing.

getsentry/sentry-dotnet#5844 only covers Serilog. On 6.12.1 the NLog
target and the log4net appender also sent a crash logged from `Main`,
and on 7.0.0-rc.2 an NLog app with only `UseSentry` drops it, so the
step covers all three.

The links to the "Capturing Startup Crashes" sections of the Serilog,
NLog and log4net guides land at the top of each page until #19925 adds
them.

Refs getsentry/sentry-dotnet#5844
Refs getsentry/sentry-dotnet#5710

## IS YOUR CHANGE URGENT?

Help us prioritize incoming PRs by letting us know when the change needs
to go live.
Select exactly one option. For deadlines, replace `YYYY-MM-DD` with the
due date. You can update this information later by editing the PR
description.

- [x] Urgent deadline (GA date, etc.): 2026-11-30
- [ ] Other deadline: YYYY-MM-DD
- [ ] No deadline: Not urgent, can wait up to 1 week+

## PRE-MERGE CHECKLIST

_Make sure you've checked the following before merging your changes:_

- [x] Checked Vercel preview for correctness, including links
- [x] PR was reviewed and approved by any necessary SMEs (subject matter
experts)
- [x] PR was reviewed and approved by a member of the [Sentry docs
team](https://github.com/orgs/getsentry/teams/docs)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: James Crosswell <jamescrosswell@users.noreply.github.com>
@ric-oliv ric-oliv mentioned this pull request Nov 9, 2026
6 of 8 tasks
@ric-oliv
ric-oliv changed the base branch from master to dotnet-v7 November 9, 2026 14:04
jamescrosswell added a commit that referenced this pull request Nov 10, 2026
> [!NOTE]
> This targets `dotnet-v7`, which collects the .NET docs for
sentry-dotnet 7.0.0. #20641 merges that branch into
`master` when 7.0.0 ships, so this PR can merge into `dotnet-v7` as soon
as it's approved.

## DESCRIBE YOUR PR

Adds a Generic Host guide for `Sentry.Extensions.Hosting`, which
sentry-dotnet 7.0.0 adds (getsentry/sentry-dotnet#5739). In 7.0.0,
`Logging.AddSentry()` no longer initializes the SDK. Worker services,
console apps on the generic host, Windows services and Azure Functions
(isolated) apps call `UseSentry` from this package instead. The page is
written for 7.x. The docs aren't versioned, so this goes live with the
rest of the 7.0.0 docs.

The guide follows the quick start template from
#19990 and covers:

- `UseSentry` on `IHostApplicationBuilder` and `IHostBuilder`, the
`Sentry` and `Logging:Sentry` sections, and why not to call
`Logging.AddSentry()` as well
- the host environment, `"Dsn": ""`, and when the SDK starts (`Build()`)
and closes (`ApplicationStopped`)
- `ClearProviders()` ordering (getsentry/sentry-dotnet#5772,
getsentry/sentry-dotnet#5776, getsentry/sentry-dotnet#5789,
getsentry/sentry-dotnet#5821)
- ASP.NET Core and MAUI apps, and the static `UseSentry` call that
Aspire's `AddServiceDefaults` needs
- the .NET Framework gap, with the `SentrySdk.Init` and
`Logging.AddSentry()` fallback and its `HubAdapter.Instance`
registrations (getsentry/sentry-dotnet#5740)
- replacing `SentrySdk.Init`, briefly. The migration guide
(#20143) covers upgrades.

It also adds
`platform-includes/configuration/config-intro/dotnet.extensions-hosting.mdx`,
so the guide's Options page starts with `UseSentry` instead of
`SentrySdk.Init`.

Closes getsentry/sentry-dotnet#5707

### Notes for review

- **Registration.** A new .NET guide only needs its `index.mdx`. The
platform key `dotnet.extensions-hosting` comes from the folder name,
guides without `sidebar_order`, like the other .NET guides, are listed
by title, and the icon falls back to the .NET one, as for the
Microsoft.Extensions.Logging, Serilog and NLog guides. The page is new,
so it needs no redirects.
- **Package version.** The install snippets use
`packages.version('sentry.dotnet')`, because the release registry has no
`sentry.dotnet.extensions.hosting` entry yet. Until 7.0.0 is out, the
preview shows 6.12.1, which doesn't exist for this package. Once the
registry has the package, switch to its own key. The `sdk:` frontmatter
already uses `sentry.dotnet.extensions.hosting` (from `Constants.cs`).
Without a registry entry, the page just has no package details box.
- **Shared includes that render wrongly for
`dotnet.extensions-hosting`.** I left them alone, since other PRs own
them:
- `platform-includes/logs/setup/dotnet.mdx` falls into the
`SentrySdk.Init` section instead of `UseSentry` with `EnableLogs`.
#19925 is adding the key to the host sections.
- `platform-includes/logs/options/dotnet.mdx` shows the generic
`EnableLogs` text and leaves out "Configure Microsoft.Extensions.Logging
Filters". Same PR.
- `platform-includes/logs/usage/dotnet.mdx` shows only the
`SentrySdk.Logger` APIs. The key belongs in the `ILogger` section too.
- `platform-includes/logs/requirements/dotnet.mdx` says logs need SDK
version 5.14.0. This package starts at 7.0.0.
- **Additions to the brief from the `version7` source:**
- `"Dsn": ""` turns the SDK off, but `SENTRY_DSN` still wins over an
empty `Dsn` (`SettingLocator.GetDsn`). The page says so.
- `Logging:Sentry` only accepts `LogLevel`, `MinimumBreadcrumbLevel` and
`MinimumEventLevel`. Any other key makes `Build()` throw
`NotSupportedException`. With no DSN anywhere, `Build()` throws
`ArgumentNullException`.
- Calling `Sentry.AspNetCore`'s `UseSentry` twice still sends each error
twice (a follow-up in getsentry/sentry-dotnet#5739). The Aspire section
says not to call it again in `Program.cs`.
- **Azure Functions** gets one line in the intro. The Azure Functions
guide still shows `logging.AddSentry(...)`. #19925
owns it.
- **Links to add once the other PRs merge:**
- Microsoft.Extensions.Logging guide: send generic host apps here, from
the "If you use a host integration such as ASP.NET Core or MAUI"
paragraph. Its `Sentry.Samples.GenericHost` sample link belongs here
too, since the sample now calls `UseSentry`.
  - Azure Functions guide: link here from the `UseSentry` setup.
- `platform-includes/logs/integrations/dotnet.mdx`: add Generic Host to
the list.
- `docs/product/logs/getting-started/index.mdx` and
`docs/product/metrics/getting-started/index.mdx`: add Generic Host to
the .NET lists.
- Migration guide, "Generic Host Apps Call UseSentry": link to this
page.
- The sample link points at `main`, where `Sentry.Samples.GenericHost`
keeps the 6.x setup until `version7` is merged.
- The C# snippets compile against `version7`, on net10.0, and on net48
for the `IHostBuilder` example and the .NET Framework fallback. On
net48, `UseSentry` on `HostApplicationBuilder` fails with CS1929, as the
page says.

## IS YOUR CHANGE URGENT?

Help us prioritize incoming PRs by letting us know when the change needs
to go live.
Select exactly one option. For deadlines, replace `YYYY-MM-DD` with the
due date. You can update this information later by editing the PR
description.

- [x] Urgent deadline (GA date, etc.): 2026-11-30
- [ ] Other deadline: YYYY-MM-DD
- [ ] No deadline: Not urgent, can wait up to 1 week+

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Ricardo Colombo Oliveira <github@ricoliv.com>
Brings in master, including #20240. Kept the 7.0.0 logging
setup in the log4net, NLog and Serilog guides, and updated the verify steps
from #20240 for 7.0.0: the integrations no longer initialize the SDK and send
logs without EnableLogs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…guides

- Start the NLog rule at Info in the UseSentry and startup crash snippets.
  AddSentry() adds a rule for every level, and the target sends every
  entry it receives as a log, so ASP.NET Core's Trace and Debug entries
  went to Sentry too.
- Set MinimumEventLevel on the log4net appender, which otherwise turns
  every entry at or above the threshold into an event.
- Rethrow after Log.Fatal in the Serilog startup snippet, like the NLog
  and log4net ones, so the app doesn't exit with code 0 after a crash.
- Fix a double space in the NLog advanced example.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keeps the deletion of the NLog-specific set-release and set-environment
includes. The NLog guide now uses the generic .NET includes, which carry
the release and environment text from #19960.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jamescrosswell added a commit that referenced this pull request Nov 11, 2026
…#19961)

> [!NOTE]
> This targets `dotnet-v7`, which collects the .NET docs for
sentry-dotnet 7.0.0. #20641 merges that branch into
`master` when 7.0.0 ships, so this PR can merge into `dotnet-v7` as soon
as it's approved.

## DESCRIBE YOUR PR

In sentry-dotnet 7.0.0 the Microsoft.Extensions.Logging integration no
longer initializes the SDK (getsentry/sentry-dotnet#5595). Generic host
apps call `UseSentry` from the new `Sentry.Extensions.Hosting` package
instead, which has its own guide (#20311). This updates the parts of
getsentry/sentry-dotnet#5706 that #19925 leaves out:

- **Microsoft.Extensions.Logging guide**:
- Generic host apps, ASP.NET Core and MAUI skip this setup and go to
their own guides. The note names generic host apps that used
`builder.Logging.AddSentry(...)` on 6.x.
- Apps without a host call `SentrySdk.Init`, then `AddSentry()`, on a
`LoggerFactory` or their own `ServiceCollection`. If they inject `IHub`,
`ISentryClient` or `Func<IHub>`, they register them with
`HubAdapter.Instance`, because `AddSentry()` no longer does
(getsentry/sentry-dotnet#5740). .NET Framework apps on
`Host.CreateApplicationBuilder()` are pointed to the Generic Host
guide's .NET Framework section.
- Structured logs are always sent on this page, and Configure says how
to send fewer.
- Removes the DSN in `AddSentry(...)`, `InitializeSdk`, and SDK settings
under `Logging:Sentry`. Documents what `Logging:Sentry` still accepts,
and `AddLogEntryFilter`.
- **Generic Host guide**: the `AddLogEntryFilter` link pointed at
`#filters`, which this page no longer has. "Replacing SentrySdk.Init"
now says `UseSentry` leaves structured logs off until `EnableLogs` is
set.
- **ASP.NET Core guide**: `SentryAspNetCoreOptions` now extends
`SentryHostOptions`, not `SentryLoggingOptions`.

Closes getsentry/sentry-dotnet#5706

### Notes for review

- Checked against `origin/version7` (51e7d99fb), which includes
getsentry/sentry-dotnet#5869:
- Every C# snippet on the Microsoft.Extensions.Logging guide compiles on
net10.0 with only `Sentry.Extensions.Logging` referenced.
- With `SentrySdk.Init` and `AddSentry()`, every `ILogger` entry is sent
as a structured log without `EnableLogs`.
- `Logging:Sentry`, added with `AddConfiguration`, is read:
`MinimumEventLevel` applies, and a category entry under `LogLevel` drops
only that category's structured logs. A `Dsn` key there throws
`NotSupportedException` from `LoggerFactory.Create`.
- Without the `HubAdapter` lines, a service that injects `IHub` fails
with `Unable to resolve service for type 'Sentry.IHub' while attempting
to activate ...`.
- `ClearProviders()` moved out with the generic host content. It applies
to ASP.NET Core's `UseSentry` too, which the ASP.NET Core guide doesn't
mention yet.
- `Filters` was always internal. The page shows `AddLogEntryFilter`.
- The ASP.NET Core paragraph leaves out namespaces. `SentryHostOptions`
is still in `Sentry.Extensions.Logging` on `version7`.
- On 6.x, `AddSentry()` after `SentrySdk.Init` initializes the SDK again
without a DSN, and that throws. That's why the 7.0.0 note tells 6.x
users to set the DSN in `AddSentry(...)` instead.
- #20240 also edits this page, against 6.x. Whichever merges second
needs a merge from `master`. This PR leaves the `Sentry` prefix alert
alone, which #20240 rewrites.

## IS YOUR CHANGE URGENT?

Help us prioritize incoming PRs by letting us know when the change needs
to go live.
Select exactly one option. For deadlines, replace `YYYY-MM-DD` with the
due date. You can update this information later by editing the PR
description.

- [x] Urgent deadline (GA date, etc.): 2026-11-30
- [ ] Other deadline: YYYY-MM-DD
- [ ] No deadline: Not urgent, can wait up to 1 week+

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Ricardo Colombo Oliveira <github@ricoliv.com>
@jamescrosswell

Copy link
Copy Markdown
Collaborator Author

Thanks Ricardo! Applied in 9978fe0:

On the duplicate events you raised on Oct 21: the "Apps That Call UseSentry" sections now cover it. For NLog, ReplaceLoggerFactory means ILogger entries only reach Sentry through the target. For log4net, the UseSentry options set MinimumEventLevel and MinimumBreadcrumbLevel to None. getsentry/sentry-dotnet#5763 covers the SDK side.

@jamescrosswell
jamescrosswell merged commit 7deb11e into dotnet-v7 Nov 11, 2026
12 checks passed
@jamescrosswell
jamescrosswell deleted the dotnet-v7-logging branch November 11, 2026 03:22
ric-oliv added a commit that referenced this pull request Nov 15, 2026
## DESCRIBE YOUR PR

This updates the .NET docs for sentry-dotnet 7.0.0, which has been on
NuGet since 2026-11-12. Each change was reviewed in its own PR against
the `dotnet-v7` branch, so the 7.x docs go live together:

- #20311 docs(dotnet): Add a Generic Host guide for SDK 7.0.0
- #20642 docs(dotnet): Add supported versions to the MAUI guide for SDK
7.0.0
- #19960 docs(dotnet): Document release and environment resolution for
SDK 7.0.0
- #19961 docs(dotnet): Update Microsoft.Extensions.Logging guide for SDK
7.0.0
- #19924 docs(dotnet): Update OTLP propagation docs for SDK 7.0.0
- #19925 docs(dotnet): Update logging docs for SDK 7.0.0
- #20715 docs(dotnet): Document ClearProviders() in the ASP.NET Core
guide for SDK 7.0.0
- #20752 docs(dotnet): Tell .NET Framework apps to install
Microsoft.Extensions.Logging for SDK 7.0.0
- #20743 docs(dotnet): Document NLog's MinimumLogLevel for SDK 7.0.0
- #20742 docs(dotnet): Link the Generic Host guide from the other .NET
pages for SDK 7.0.0
- #20689 docs(dotnet): Update the 7.x migration guide for 7.0.0
- #20780 docs(dotnet): Fix Serilog flushing, Serilog usings and the
Azure Functions package for SDK 7.0.0
- #20781 docs(dotnet): Fix the .NET logs and metrics examples and other
pages for SDK 7.0.0

### Issues this closes

Closes getsentry/sentry-dotnet#5710

The other docs issues for 7.0.0 were closed when their PRs merged into
`dotnet-v7`.

### Before merging

- [x] sentry-dotnet 7.0.0 is on NuGet.
- [x] The release candidate alert is gone from
`includes/dotnet-v7-migration-overview.mdx`.
- [x] The links that #20311, #19961 and #19925 left for after the other
PRs merge are in.
- [x] `master` is merged into `dotnet-v7`, and the Vercel preview looks
right.
- [x] This description has a `Closes` line for every issue that's still
open.

## IS YOUR CHANGE URGENT?

Help us prioritize incoming PRs by letting us know when the change needs
to go live.
Select exactly one option. For deadlines, replace `YYYY-MM-DD` with the
due date. You can update this information later by editing the PR
description.

- [x] Urgent deadline (GA date, etc.): 2026-11-13
- [ ] Other deadline: YYYY-MM-DD
- [ ] No deadline: Not urgent, can wait up to 1 week+

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: James Crosswell <jamescrosswell@users.noreply.github.com>
Co-authored-by: ric-oliv <ric-oliv@users.noreply.github.com>
Co-authored-by: ric-oliv <5938598+ric-oliv@users.noreply.github.com>
Co-authored-by: Alex Krawiec <alex.krawiec@sentry.io>

This branch was successfully deployed

2 active (1 outdated) deployments
Preview – sentry-docs — 96ca337c Deployed Nov 11, 2026 by vercel[bot]
Preview – develop-docs — 297ead72 Deployed Nov 10, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority: Urgent Docs review is needed immediately for an urgent deadline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document the logging changes for v7.0.0

2 participants