Skip to content

docs(dotnet): Show how to turn off logs from Logging.AddSentry() - #20947

Open
ric-oliv wants to merge 2 commits into
masterfrom
docs/dotnet-logs-off-switch-migration
Open

ric-oliv wants to merge 2 commits into
masterfrom
docs/dotnet-logs-off-switch-migration

Conversation

@ric-oliv

@ric-oliv ric-oliv commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

DESCRIBE YOUR PR

Since 7.0.0, apps that call SentrySdk.Init and add Logging.AddSentry() send every ILogger entry to Sentry as a log. The migration guide only shows SetBeforeSendLog(_ => null) to turn that off. That callback still builds each log before it drops it, and it can't be set from configuration. getsentry/sentry-dotnet#5988 asks for a switch that can.

That switch already exists. The logs provider that Logging.AddSentry() adds has the Sentry alias, so setting Logging:Sentry:LogLevel:Default to None turns off its logs and keeps its errors and breadcrumbs. The migration guide now shows it next to SetBeforeSendLog as a second option, in configuration and in code. The Logs page already named the alias. It now also says that a LogLevel section under Logging:Sentry applies only to Sentry's logs, and that its keys are categories.

I ran the snippets against Sentry.Extensions.Logging 7.0.0. With None, an info, a warning and an error still produced three breadcrumbs and one event, and no logs. A per-category level under Logging:Sentry changed only which entries became logs and left breadcrumbs unchanged.

Refs getsentry/sentry-dotnet#5988

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
  • No deadline: Not urgent, can wait up to 1 week+

PRE-MERGE CHECKLIST

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

  • Checked Vercel preview for correctness, including links
  • PR was reviewed and approved by any necessary SMEs (subject matter experts)
  • PR was reviewed and approved by a member of the Sentry docs team

@vercel

vercel Bot commented Nov 23, 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 23, 2026 4:42pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
develop-docs Ignored Ignored Preview Nov 23, 2026 4:42pm UTC

Request Review

The v7 migration guide only showed SetBeforeSendLog(_ => null) for
dropping logs. Apps that call SentrySdk.Init and Logging.AddSentry() can
set the Sentry provider's level to None instead, which keeps errors and
breadcrumbs, works from configuration and creates no logs.

Refs getsentry/sentry-dotnet#5988

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Logs page said Sentry's provider has the alias Sentry, but not what
that means for filters, so Logging:Sentry:LogLevel read as if Sentry
were a category. The note now says a LogLevel section under
Logging:Sentry applies only to Sentry's logs and its keys are
categories.

Refs getsentry/sentry-dotnet#5988

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ric-oliv
ric-oliv force-pushed the docs/dotnet-logs-off-switch-migration branch from 989a0a2 to d9c9e51 Compare November 23, 2026 16:37
@ric-oliv
ric-oliv marked this pull request as ready for review November 23, 2026 16:44
@cursor

cursor Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Getting ready to monitor this change · Rollout details

Status Service Environment
⏳ Getting ready to monitor this change

This branch was successfully deployed

1 active deployment
Preview – sentry-docs — d9c9e514 Deployed Nov 23, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority: Normal Docs review has no urgent deadline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants