Capture exceptions from Microsoft.Extensions.Logging entries
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- csharp
- Domain
- backend-api-design
Research direction
Read the exception event metadata spec linked in the issue and review the existing handling in PostHogOptions.CaptureUnhandledExceptions, the request middleware, and runtime hooks. Decide the provider package, public API, category filtering, and request context behavior before implementation. Done means qualifying logged exceptions are captured with the specified metadata, SDK logs cannot recurse, and duplicate reports are suppressed across integrations.
Written by the indexing model from the issue text.
Description
Problem
PostHogOptions.CaptureUnhandledExceptions (#356) reports exceptions that reach AppDomain.UnhandledException or TaskScheduler.UnobservedTaskException. Exceptions that application or framework code catches and logs never reach either hook, because they are already handled or observed. This includes many hosted BackgroundService failures, which the host logs before it stops.
Proposal
Add an optional Microsoft.Extensions.Logging provider that captures the exception attached to a qualifying log entry.
- Opt-in, with a configurable minimum level (suggested default:
Error). - Only entries that carry an
Exceptionproduce an event. - Event metadata follows the exception event metadata spec:
mechanism.typelogger,handled: true,$exception_levelnormalized from the log level, and a$exception_sourcefor the integration (for exampledotnet.microsoft_extensions_logging). - Entries logged by the SDK itself are filtered out, so a failed capture cannot recurse.
- Deduplicate against the request middleware and the runtime hooks, so an exception that is logged and then escapes is reported once.
Open questions
- Which package hosts the provider:
PostHog(which already depends on the logging abstractions) orPostHog.AspNetCore. - The public API shape: an
ILoggingBuilderextension, its options type, and whether category filters are needed in the first version. - Whether the request context (
distinct_id, session) is applied when the entry is logged inside a request.
Context
Raised as a non-blocking follow-up in the review of #356.
- Dominant language
- C#
- Stars
- 47
- Forks
- 23
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 30
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from PostHog/posthog-dotnet
-
Flush pending events on AppDomain.ProcessExitPossibly taken @hpouillot claimed this 3 days ago. Openenhancement feature/error-tracking
Difficulty 5/5 Over a week Newbie friendliness 45/100
PostHog/posthog-dotnet#385 · 1 comment ·
Maintainers usually reply within 1 day
-
enhancement feature/error-tracking
Difficulty 4/5 3-5 days Newbie friendliness 45/100
PostHog/posthog-dotnet#333 · 1 comment ·
Maintainers usually reply within 1 day
-
enhancement team/llm-analytics
Difficulty 5/5 Over a week Newbie friendliness 25/100
PostHog/posthog-dotnet#224 ·
Maintainers usually reply within 1 day
-
SDK referencesOpendocumentation
Difficulty 3/5 1-2 days Newbie friendliness 45/100
PostHog/posthog-dotnet#212 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 35/100
PostHog/posthog-dotnet#210 · 2 reactions ·
Maintainers usually reply within 1 day
All issues in PostHog/posthog-dotnet
Similar issues
-
quality 提案 要トリアージ
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
Maintainers usually reply within 1 day
-
The Language and Region lists in Options read to a screen reader as "LanguageInfo { Id = ar, ... }"Openbug localization small ui
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
hexide-io/HexIDE#4176 · 1 comment ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
MarcelRoozekrans/Rag.NET#1030 ·
Maintainers usually reply within 1 day
-
ReapplyLocalizationsToAllComponents aborts (and keeps aborting) on a disposed registered controlOpen
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
AvaloniaUI/Avalonia#22841 ·
Maintainers usually reply within 1 day