Skip to content

ILoggerFactory.AddSentry() sends no structured logs #5908

Closed

Description

@jamescrosswell

ILoggerFactory.AddSentry() adds only the events provider, SentryLoggerProvider (src/Sentry.Extensions.Logging/SentryLoggerFactoryExtensions.cs). ILoggingBuilder.AddSentry() adds that and SentryStructuredLoggerProvider.

In 7.0.0, an app that calls SentrySdk.Init and ILoggingBuilder.AddSentry() sends every ILogger entry as a structured log, with no logs-specific option (#5642). An app that calls SentrySdk.Init and the ILoggerFactory overload instead gets events and breadcrumbs, but no logs, and nothing tells it so. That includes new LoggerFactory().AddSentry(...), the form the 6.x Microsoft.Extensions.Logging guide showed. 6.x behaves the same, but there logs also needed EnableLogs, so it was less visible.

@ric-oliv found this while reviewing getsentry/sentry-docs#19961.

Options

  • Add the structured logs provider in the ILoggerFactory overload too, so both overloads behave the same.
  • Or make the ILoggerFactory overload obsolete, in favour of LoggerFactory.Create(builder => builder.AddSentry()).

Either should land before 7.0.0, since the 7.0 docs say AddSentry() sends logs.

Activity

  1. added this to the 7.0.0 milestone on Nov 10, 2026
  2. added
    Bug
    .NET
    on Nov 10, 2026
  3. linear-code commented on Nov 10, 2026

    @linear-code
  4. added a commit that references this issue on Nov 12, 2026
    a73e2f8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

.NETBugLogsMicrosoft.Extensions.LoggingState: Needs Discussion

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions