Skip to content

fix(quartz): skip Quartz's duplicate error log with UseSentry - #5836

Merged
ric-oliv merged 1 commit into
version7from
fix/quartz-log-filter-host-options
Oct 30, 2026
Merged

ric-oliv merged 1 commit into
version7from
fix/quartz-log-filter-host-options

Conversation

@ric-oliv

Copy link
Copy Markdown
Member

On version7, a Quartz job that throws in an ASP.NET Core or generic host app gets captured twice.

Sentry.Quartz filters out Quartz's own error log entry for an exception it has already captured. That filter only went to SentryLoggingOptions. On version7, the ASP.NET Core, generic host, MAUI and Blazor options derive from SentryHostOptions and keep their logging options in SentryHostOptions.Logging, so the filter never reached them. Every failing job sent its exception plus a second event for Quartz's JobExecutionProcessException. The filter now goes to SentryHostOptions too, through its public AddLogEntryFilter.

The existing test didn't catch this. On version7, logging.AddSentry() sends to the global hub and not to the test's substitute, so the test still passed with the filter removed completely. It now swaps the global hub for the substitute. A new test runs the job through ASP.NET Core's UseSentry, and it fails without the fix. I dropped the test that only counted registrations, because the two behavior tests fail for every mutant it caught.

Sentry.Quartz3 isn't affected, because it doesn't have this filter. Sentry.Quartz hasn't shipped yet, so this needs no changelog entry.

#skip-changelog

QuartzErrorLogFilterSetup only added its filter to SentryLoggingOptions. On version7, the
ASP.NET Core, generic host, MAUI and Blazor options derive from SentryHostOptions and keep
their logging options in SentryHostOptions.Logging, so the filter never reached their logger
providers. A job that threw was captured twice: once by SentryScopeMiddleware, and once from
Quartz's ErrorLogger entry, wrapped in a JobExecutionProcessException.

The existing test didn't notice, because on version7 logging.AddSentry() sends to the global
hub and not to the test's substitute. It now swaps the global hub for the substitute, and a
second test runs the job through ASP.NET Core's UseSentry. The registration-count test is
dropped: both behavior tests fail for every registration mutant it caught.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.78%. Comparing base (d28aa8b) to head (28f04aa).

Additional details and impacted files
@@             Coverage Diff              @@
##           version7    #5836      +/-   ##
============================================
+ Coverage     76.76%   76.78%   +0.01%     
============================================
  Files           539      539              
  Lines         19694    19697       +3     
  Branches       3851     3852       +1     
============================================
+ Hits          15119    15124       +5     
+ Misses         3703     3701       -2     
  Partials        872      872              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ric-oliv
ric-oliv marked this pull request as ready for review October 30, 2026 07:57
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Oct 30, 2026
@ric-oliv
ric-oliv merged commit 8c04381 into version7 Oct 30, 2026
61 of 62 checks passed
@ric-oliv
ric-oliv deleted the fix/quartz-log-filter-host-options branch October 30, 2026 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants