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
{{ message }}
Repository navigation
NLog: AddSentry() has no minimum level, so Trace and Debug entries routed through NLog are sent as logs #5909
LoggingConfiguration.AddSentry() adds a rule for every level (configuration.AddRuleForAllLevels(targetName) in src/Sentry.NLog/ConfigurationExtensions.cs). In 7.0, the Sentry target sends every entry it receives as a structured log. SentryNLogOptions has MinimumEventLevel and MinimumBreadcrumbLevel, but nothing that limits logs.
This matters when an app routes its ILogger entries through NLog with AddNLog(new NLogProviderOptions { ReplaceLoggerFactory = true }), as the 7.0 docs recommend for apps that call UseSentry. NLog's rules then replace the levels in the Logging section, so with AddSentry() every Trace and Debug entry from ASP.NET Core goes to Sentry as a log. @ric-oliv measured 15 Debug and 2 Trace logs for starting a minimal app, serving one request and stopping it (getsentry/sentry-docs#19925).
The docs now work around it by adding the rule themselves:
That skips AddSentry(), and needs the NLog.LogLevel prefix in ASP.NET Core apps, where LogLevel is ambiguous.
Proposal
Logs need a minimum level that is separate from breadcrumbs and events. An app that wants Trace breadcrumbs but only Info and higher as logs should be able to have both.
MEL is the ideal. Logs come from their own provider, SentryStructuredLoggerProvider, aliased Sentry, so Logging:Sentry:LogLevel filters logs without touching breadcrumbs or events.
NLog can't do that. A single SentryTarget sends events, breadcrumbs and logs, and NLog's rules decide what reaches the target as a whole. A rule (or a minLevel parameter on AddSentry() that adds one) would filter breadcrumbs and events along with logs.
So follow Serilog, with NLog's rules as the gate. In Serilog, RestrictedToMinimumLevel gates everything that reaches the sink, and MinimumEventLevel and MinimumBreadcrumbLevel set thresholds for each kind of data. In NLog:
The rule plays the part of RestrictedToMinimumLevel, as it already does.
SentryNLogOptions gets MinimumLogLevel, next to MinimumEventLevel and MinimumBreadcrumbLevel. It defaults to Info, only filters logs, and is also a target attribute (minimumLogLevel) for XML config.
With the Info default, the docs can go back to a plain config.AddSentry(...). Changing the default is easiest before 7.0.0.
Activity
linear-code commentedon Nov 10, 2026
NET-921
feat(nlog): add MinimumLogLevel so Trace and Debug entries aren't sen…
jamescrosswell commentedon Nov 11, 2026
Fixed in #5913 on
version7.