You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Instrument popular logging libraries to send logs to Sentry. SDK maintainers can best decide what they should support, but we should definitely support the same integrations that we do in the SDK (NLog, Serilog, etc.)
Create a GH discussion that contains instructions for setting up the SDK in your repo. Eventually this will be moved into the primary docs. See the JS SDK's GH discussion for inspiration.
Ship the barebone Sentry API into the core Sentry package
Make this work from Microsoft.Extensions.Logging
Make this work from Serilog
Make this work from NLog
Make this work from log4net
I'll dare to say that no one in .NET will use "Sentry's logging API". I know I wouldn't. But that's not the point.
The point is to have the API in the main SDK, so that the logging libraries integrations only pipe data to it.
The order above allows us to try/test things incrementally.
Once we get to n2, we can add it to nuget-trends and symbol-collector for dogfooding.
All our current logging integrations do:
Check level, if higher than MininumEventLevel it records an event
Check level, if higher than MinimumBreadcrumbLevel it adds a breadcrumb
// Exception.Message won't be used as Breadcrumb message
// Avoid losing it by adding as data:
data??=newDictionary<string,string>();
data.Add("exception_message",exception.Message);
}
_hub.AddBreadcrumb(
_clock,
(message??exception?.Message)!,
CategoryName,
null,
data,
logLevel.ToBreadcrumbLevel());
}
}
The crumb goes after, so that in a subsequent event, it will include the breadcrumb of the previous event.
This works well for error monitoring. But with the new logging integration, we'll send all logs to Sentry.
The new logging could be a new logger class, that's added in of logging is enabled. Since little is shared from the current logger described above, and the new one.
Hey @wondertalik - thanks for your interest! At the current moment we are focusing on adding logs support via the Sentry SDKs. We'll evaluate OpenTelemetry support in the future. Our logs schema is a superset of the OpenTelemetry schema, so we are already compatible with OpenTelemetry.
Hi there, awesome work on the Sentry log integration so far!
In my apps I have a logging section in the appsettings.json file. However, I still see many log messages that I don't expect based on the configuration below in Sentry. Do I need to configure the log level separately in the Sentry SDK? I did see a SentryLoggingOptions.ExperimentalLogging.MinimumLogLevel property. Are we expected to set that property instead of the built-in log level settings in ASP.NET Core?
With 5.x yes ... there is indeed the option SentryLoggingOptions.ExperimentalLogging.MinimumLogLevel.
However, this solution does not allow for per-category-name based granularity.
This option is (very soon: was) a workaround.
With the upcoming 6.0.0 (next couple of days), this option will be gone and our Microsoft.Extensions.Logging for Sentry Structured Logs will properly respect Configuration like appsettings.json, appsettings.{HostEnvironment}.json and also programmatic Configuration like builder.Logging.AddFilter(null, LogLevel) and builder.Logging.AddFilter("My.Category.Name", LogLevel).
The reason we had to do this in a major version is that there is a behavioral breaking change involved, as we noticed inconsistencies during implementation.
For more details on that see #4700.
The TL;DR; is:
6.0.0 is fixing inconsistencies of filtering within all of Sentry's Microsoft.Extensions.Logging-based integrations, to be not only as originally intended, but also idiomatic across the ecosystem
With 5.x yes ... there is indeed the option SentryLoggingOptions.ExperimentalLogging.MinimumLogLevel. However, this solution does not allow for per-category-name based granularity. This option is (very soon: was) a workaround.
With the upcoming 6.0.0 (next couple of days), this option will be gone and our Microsoft.Extensions.Logging for Sentry Structured Logs will properly respect Configuration like appsettings.json, appsettings.{HostEnvironment}.json and also programmatic Configuration like builder.Logging.AddFilter(null, LogLevel) and builder.Logging.AddFilter("My.Category.Name", LogLevel).
The reason we had to do this in a major version is that there is a behavioral breaking change involved, as we noticed inconsistencies during implementation. For more details on that see #4700. The TL;DR; is:
6.0.0 is fixing inconsistencies of filtering within all of Sentry's Microsoft.Extensions.Logging-based integrations, to be not only as originally intended, but also idiomatic across the ecosystem
Breadcrumbs are filtered by
SentryLoggingOptions.MinimumBreadcrumbLevel
SentryLoggingOptions.AddLogEntryFilter
SentryOptions.SetBeforeBreadcrumb
Events are filtered by
SentryLoggingOptions.MinimumEventLevel
SentryLoggingOptions.AddLogEntryFilter
SentryOptions.SetBeforeSend
Logs are filtered by
Configuration as mentioned above
SentryOptions.SetBeforeSendLog
Can we still set a minimum log level for MAUI App? or we have to keep using SentryOptions.SetBeforeSendLog ?
For context, prior to version 6 we were doing
Yes, as of Sentry v6.0.0 the minimum log level is now configured idiomatically via the Microsoft.Extensions.Logging infrastructure. SentryOptions.SetBeforeSendLog is no longer necessary to filter logs per Log-Level and/or per Category. But you may still use it to drop and/or scrub logs based on other Attributes.
And SentryLoggingOptions.ExperimentalLogging.MinimumLogLevel is no longer available.
Although .NET MAUI does not support appsettings.{Environment}.json out of the box, you could set it up yourself (with some caveats). But all other means of configuration do work out of the box, like AddFilter you mentioned, configuring the minimum log level on a per-Category basis.
Activity
bruno-garcia commentedon Apr 23, 2025
The idea is to:
SentrypackageMicrosoft.Extensions.LoggingSerilogNLoglog4netI'll dare to say that no one in .NET will use "Sentry's logging API". I know I wouldn't. But that's not the point.
The point is to have the API in the main SDK, so that the logging libraries integrations only pipe data to it.
The order above allows us to try/test things incrementally.
Once we get to n2, we can add it to nuget-trends and symbol-collector for dogfooding.
All our current logging integrations do:
MininumEventLevelit records an eventMinimumBreadcrumbLevelit adds a breadcrumbe.g:
sentry-dotnet/src/Sentry.Extensions.Logging/SentryLogger.cs
Lines 39 to 86 in 084e3b4
The crumb goes after, so that in a subsequent event, it will include the breadcrumb of the previous event.
This works well for error monitoring. But with the new logging integration, we'll send all logs to Sentry.
The new logging could be a new logger class, that's added in of logging is enabled. Since little is shared from the current logger described above, and the new one.
Flash0ver commentedon May 15, 2025
Sentry Structured Logging for .NET
Sentry.Extensions.LoggingCaptureLogonIHubandISentryClientIHubandISentryClientSentry.AspNetCoreandSentry.MauiSentry.Extensions.LoggingMicrosoft.Extensions.Logging.Abstractions.IBufferedLoggerinterfaceMicrosoft.Extensions.Logging.ILoggerSentry.AspNetCoreSentry.AspNetCore.Blazor.WebAssemblySentry.Azure.Functions.WorkerSentry.MauiSentry.SerilogSentry.NLogSentry.Log4NetSentry.UnityIHubandISentryClientLog{Level}methodEnableLogs is false[InterpolatedStringHandler]wondertalik commentedon May 20, 2025
Hey,
Thanks for this feature that are you working on. Any plans to adapt opentelemetry for logs as you did for tracing?
AbhiPrasad commentedon May 20, 2025
Hey @wondertalik - thanks for your interest! At the current moment we are focusing on adding logs support via the Sentry SDKs. We'll evaluate OpenTelemetry support in the future. Our logs schema is a superset of the OpenTelemetry schema, so we are already compatible with OpenTelemetry.
160 remaining items
mvdgun commentedon Dec 4, 2025
Hi there, awesome work on the Sentry log integration so far!
In my apps I have a logging section in the appsettings.json file. However, I still see many log messages that I don't expect based on the configuration below in Sentry. Do I need to configure the log level separately in the Sentry SDK? I did see a
SentryLoggingOptions.ExperimentalLogging.MinimumLogLevelproperty. Are we expected to set that property instead of the built-in log level settings in ASP.NET Core?Flash0ver commentedon Dec 4, 2025
With
5.xyes ... there is indeed the optionSentryLoggingOptions.ExperimentalLogging.MinimumLogLevel.However, this solution does not allow for per-category-name based granularity.
This option is (very soon: was) a workaround.
With the upcoming
6.0.0(next couple of days), this option will be gone and ourMicrosoft.Extensions.Loggingfor Sentry Structured Logs will properly respect Configuration likeappsettings.json,appsettings.{HostEnvironment}.jsonand also programmatic Configuration likebuilder.Logging.AddFilter(null, LogLevel)andbuilder.Logging.AddFilter("My.Category.Name", LogLevel).The reason we had to do this in a major version is that there is a behavioral breaking change involved, as we noticed inconsistencies during implementation.
For more details on that see #4700.
The
TL;DR;is:6.0.0is fixing inconsistencies of filtering within all of Sentry'sMicrosoft.Extensions.Logging-based integrations, to be not only as originally intended, but also idiomatic across the ecosystemSentryLoggingOptions.MinimumBreadcrumbLevelSentryLoggingOptions.AddLogEntryFilterSentryOptions.SetBeforeBreadcrumbSentryLoggingOptions.MinimumEventLevelSentryLoggingOptions.AddLogEntryFilterSentryOptions.SetBeforeSendSentryOptions.SetBeforeSendLogSyed-RI commentedon Dec 17, 2025
Can we still set a minimum log level for MAUI App? or we have to keep using
SentryOptions.SetBeforeSendLog?For context, prior to version 6 we were doing
I that correct?
And Im assuming now we have to do
Flash0ver commentedon Dec 23, 2025
TL;DR: correct!
Yes, as of Sentry v6.0.0 the minimum log level is now configured idiomatically via the
Microsoft.Extensions.Logginginfrastructure.SentryOptions.SetBeforeSendLogis no longer necessary to filter logs per Log-Level and/or per Category. But you may still use it to drop and/or scrub logs based on other Attributes.And
SentryLoggingOptions.ExperimentalLogging.MinimumLogLevelis no longer available.Although .NET MAUI does not support
appsettings.{Environment}.jsonout of the box, you could set it up yourself (with some caveats). But all other means of configuration do work out of the box, likeAddFilteryou mentioned, configuring the minimum log level on a per-Category basis.e.g.
Flash0ver commentedon Dec 23, 2025
Closing this issue with the base infrastructure complete and stable.
Follow-ups for Q1 2026 are