Repository navigation
feat(mel)!: remove ILoggerFactory.AddSentry() in favour of ILoggingBuilder.AddSentry() - #5921
Merged
Merged
Conversation
The ILoggerFactory overload only added the events provider, so apps using it got no structured logs, no IConfiguration binding and no recursion filter. It's now an error-level obsolete stub that points to LoggerFactory.Create(builder => builder.AddSentry()). Closes #5908 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## version7 #5921 +/- ##
=========================================
Coverage 76.98% 76.98%
=========================================
Files 538 538
Lines 19714 19716 +2
Branches 3872 3873 +1
=========================================
+ Hits 15176 15179 +3
- Misses 3666 3667 +1
+ Partials 872 870 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
jamescrosswell
marked this pull request as ready for review
November 12, 2026 05:14
16 of 19 tasks
1 of 6 tasks
ric-oliv
approved these changes
Nov 12, 2026
ric-oliv
left a comment
Member
There was a problem hiding this comment.
LGTM! .NET Framework apps get Microsoft.Extensions.Logging 2.1 from our package, and that has no LoggerFactory.Create, so I added a line about it to the MEL guide in getsentry/sentry-docs#20752.
jamescrosswell
pushed a commit
to getsentry/sentry-docs
that referenced
this pull request
Nov 12, 2026
…s.Logging for SDK 7.0.0 (#20752) <!-- Keep the urgency section so automation can prioritize this PR. You may delete other sections you don't need. --> ## DESCRIBE YOUR PR On .NET Framework, `Sentry.Extensions.Logging` brings in `Microsoft.Extensions.Logging` 2.1. That version has no `LoggerFactory.Create`, and the app doesn't get `ServiceCollection` either, so neither setup example on the MEL page compiles there. Installing the `Microsoft.Extensions.Logging` package fixes both. This adds a line saying so under Install. getsentry/sentry-dotnet#5921 sends callers of `ILoggerFactory.AddSentry()` to `LoggerFactory.Create`, so those apps end up on this page. It targets `dotnet-v7`, so it goes live with the rest of the 7.0.0 docs in #20641. Refs getsentry/sentry-dotnet#5921 ## 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.): the .NET SDK 7.0.0 release, with #20641 - [ ] Other deadline: YYYY-MM-DD - [ ] No deadline: Not urgent, can wait up to 1 week+ ## SLA - Teamwork makes the dream work, so please add a reviewer to your PRs. - Please give the docs team up to 1 week to review your PR unless you've supplied a deadline. Thanks in advance for your help! ## 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](https://github.com/orgs/getsentry/teams/docs) ## EXTRA RESOURCES - [Sentry Docs contributor guide](https://docs.sentry.io/contributing/) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
27 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ILoggerFactory.AddSentry()only added the events provider (SentryLoggerProvider). UnlikeILoggingBuilder.AddSentry(), it never sent structured logs, didn't bind theLogging:Sentryconfiguration section, and didn't add theSentry.ISentryClientfilter that keeps the structured logger from logging its own diagnostics recursively.ILoggerFactoryhas noAddFilter, so making the two overloads behave the same would mean a second code path to maintain.This turns the overload into an
[Obsolete(error: true)]stub that throwsNotSupportedException, likeILoggingBuilder.AddSentry(string dsn)on this branch. The compile error tells users to add Sentry while building the factory:Most existing callers have to change this line in 7.0 anyway, because
SentryLoggingOptions.DsnandInitializeSdkare already error-level obsolete, which breaks thenew LoggerFactory().AddSentry(o => o.Dsn = ...)form from the 6.x docs.LoggerFactory.Createwas added in Microsoft.Extensions.Logging 3.0. Apps on thenetstandard2.0floor (MEL 2.1) can usenew ServiceCollection().AddLogging(b => b.AddSentry()).BuildServiceProvider().GetRequiredService<ILoggerFactory>()instead.Closes #5908
🤖 Generated with Claude Code