Skip to content

fix(logging): ship Information-level logs in Release/Beta/Nightly builds - #2611

Merged
Belphemur merged 3 commits into
devfrom
fix/release-log-levels
Nov 19, 2026
Merged

Belphemur merged 3 commits into
devfrom
fix/release-log-levels

Conversation

@Belphemur

Copy link
Copy Markdown
Owner

Problem

Users of shipped builds (Release / Beta / Nightly) see debug-grade messages in soundswitch.log, e.g. the per-PID "Access is denied" chatter:

  • SoundSwitch/UI/Forms/ProcessSelectionForm.cs:253 — Failed to get process path for {ProcessName} (PID: {PID})
  • SoundSwitch/Services/AppSoundLockManager.cs:242/266/293/594/640 — Couldn't … process PID {PID}

Root cause

LoggerConfigurator.cs keyed the Serilog pipeline minimum level on RELEASE:

#if RELEASE
        .MinimumLevel.Debug()
#else
        .MinimumLevel.Verbose()
#endif

But the csproj configurations do not all define RELEASE:

Configuration DefineConstants Effective file-sink min level
Debug TRACE;DEBUG Verbose (intended — local dev)
Release RELEASE Debug (the reported bug)
Beta TRACE;BETA Verbose (#else)
Nightly TRACE;NIGHTLY Verbose (#else)

All three shipped configurations wrote Debug/Verbose events to the log file — and Beta/Nightly were noisier than Release.

Fix

Key the pipeline minimum level on DEBUG — the only configuration that should ever see debug-grade output:

#if DEBUG
        .MinimumLevel.Verbose()
#else
        .MinimumLevel.Information()
#endif
  • Debug config: unchanged (Verbose).
  • Release / Beta / Nightly: Information minimum — shipped logs now contain switch events (Set Default device: …), app-rule matches, profile triggers, warnings, and errors; no per-PID access-denied chatter.
  • No _logger.Debug call-site rewrites: the level change covers them by design. An audit (ADR §5) found no support-critical message below Information — device-switch outcomes and rule matches are already Information.
  • Console sink (#if DEBUG-only) and Sentry sink settings (MinimumBreadcrumbLevel = Debug, MinimumEventLevel = Error) unchanged. Note: the global minimum gates all sinks, so shipped Sentry breadcrumbs effectively become Information+ (Sentry's own default is Info); error events are unaffected.
  • Trace.Write/WriteLine (mapped to Serilog Debug by SerilogTraceListener 3.2.0 — verified empirically) also stops reaching shipped logs; all four affected call sites are benign handled diagnostics (WindowsAPIAdapter thread-race notes, AudioSwitcher "Default endpoint already …" no-op skips).

Design decision record: docs/design/logging/2026-11-18-release-log-levels.md.

Validation

  • Linux gate green in all three compiled configurations (Debug, Release, Nightly): dotnet build SoundSwitch/SoundSwitch.csproj -c <cfg> -p:LinuxBuild=true -p:BuildProjectReferences=false → 0 errors (4 pre-existing warnings, untouched files).
  • Self-checks: grep -rn "MinimumLevel" SoundSwitch/ shows only the new policy; git diff review confirms no _logger.Debug call sites touched.
  • No website page documents log verbosity (only log export), so no docs-sync change was needed.
  • Windows-only manual checks (log inspection per configuration) listed in the ADR test plan — CI/owner to confirm.

Key the Serilog pipeline minimum level on DEBUG instead of RELEASE:
Debug config keeps Verbose; Release, Beta and Nightly all log at
Information minimum to the rolling file sink.

The old #if RELEASE gate matched only the Release configuration
(DefineConstants: RELEASE), so Beta (TRACE;BETA) and Nightly
(TRACE;NIGHTLY) fell into #else and logged at Verbose — noisier than
Release — and Release itself still logged Debug-grade diagnostics
(e.g. per-PID access-denied chatter from ProcessSelectionForm and
AppSoundLockManager) into shipped soundswitch.log files.

Console sink (#if DEBUG) and Sentry sink settings are unchanged.
@kody-ai

kody-ai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Code Review Could Not Complete ⚠️

The review failed before suggestions could be generated.

Reason: The configured API key (open_router) is out of credits or has hit its billing limit. Top up the account or adjust the plan.

open_router · ~deepseek/deepseek-flash-latest · HTTP 402 · generalist

Provider said: Insufficient credits. Add more using https://openrouter.ai/settings/credits

After fixing the issue, comment @kody review on this PR to re-run the review.

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Validate Business Logic: Ask Kody to validate your code against business rules by adding a comment with the @kody -v business-logic command.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ✅

Access your configuration settings here.

​

@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • Production builds now use Information as the minimum log level, so debug-level messages are no longer included. Development builds continue to capture detailed logs.
    • Disposal-related errors during Windows API shutdown are ignored; other shutdown errors are logged as warnings.
  • Documentation
    • Added documentation describing the logging-level policy for development and production builds, along with related logging decisions and test plans.

The logger now selects Verbose for DEBUG builds and Information otherwise. WindowsAPIAdapter.Stop ignores ObjectDisposedException and logs other exceptions at Warning level. An ADR documents these changes and their validation.

Changes: Logging Level Policy

Layer / File(s) Summary
Minimum log level policy
SoundSwitch/Framework/Logger/Configuration/LoggerConfigurator.cs, docs/design/logging/2026-11-18-release-log-levels.md
The logger selects Verbose for DEBUG builds and Information otherwise. The ADR documents the policy, expected logging effects, and manual validation steps.
Stop exception handling
SoundSwitch/Framework/WinApi/WindowsAPIAdapter.cs, docs/design/logging/2026-11-18-release-log-levels.md
Stop ignores ObjectDisposedException. It logs other exceptions at Warning level instead of writing them to the trace.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: Minimal · up to b32d6

Shipped builds will write less diagnostic log output, while warnings, errors and key Information events are kept. The change is low-risk and easy to revert, with no concrete merge-blocking issue identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: shipped Release, Beta, and Nightly builds now emit Information-level logs. It matches the logger level change in LoggerConfigurator.cs and the stated objectives. The c…
Description check Passed The description states the problem, root cause, fix, and validation. It matches the LoggerConfigurator.cs change, the Trace routing effect, and the ADR reference. It also describes the build checks an…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: shipped Release, Beta, and Nightly builds now emit Information-level logs. It matches the logger level change in LoggerConfigurator.cs and the stated objectives. The conventional-commit prefix is a style choice and does not affect relevance.

Full details: Description check

Explanation

The description states the problem, root cause, fix, and validation. It matches the LoggerConfigurator.cs change, the Trace routing effect, and the ADR reference. It also describes the build checks and the pending Windows manual checks.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit checks the log levels bright,
Verbose in Debug, Information right.
A disposed form can quietly rest,
Other warnings are logged with care.
The rabbit hops through logs, content.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a266e6bc-3352-4188-bc7b-fd04423d4928
Commits

Reviewing files that changed from the base of the PR and between debd17e and b32d69e.

Files selected for processing: 2

  • SoundSwitch/Framework/WinApi/WindowsAPIAdapter.cs
  • docs/design/logging/2026-11-18-release-log-levels.md
Files skipped from review as they are similar to previous changes: 1

  • docs/design/logging/2026-11-18-release-log-levels.md

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

@qodo-code-review

qodo-code-review Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

PR Summary by Qodo

Keep debug logs out of shipped builds

🐞 Bug fix 📝 Documentation 🕐 10-20 Minutes

Grey Divider

AI Description

• Set Release, Beta, and Nightly logging to Information and above, removing debug-grade chatter from
 shipped logs.
• Preserve Verbose logging in Debug builds without changing log call sites or sink settings.
• Document the configuration mismatch, sink implications, and manual validation plan.
Merge Risk 🟡 Medium

Blast radius 🟡 Medium 💥 2 capabilities

  • 2 affected capabilities within one bounded functional scope: shipped_observability.
  • The global logger writes the rolling application log, Settings exports that log, and the Stop() caller emits shutdown diagnostics into the same file sink.
  • These are one bounded support-diagnostics behavior: the new catch promotion changes visibility of one shutdown fault without creating a separate product capability.
  • The Sentry sink attaches Serilog events as breadcrumb context to remote Error events.
  • It shares the logger pipeline with file logging, but its consumer outcome—remote crash/error diagnosis—is distinct from locally exported log files; the WindowsAPIAdapter promotion does not create a separate Sentry capability.
Sources

SoundSwitch/Framework/Logger/Configuration/LoggerConfigurator.cs[21-24]

#if DEBUG
            .MinimumLevel.Verbose()
#else
            .MinimumLevel.Information()

SoundSwitch/Program.cs[119-120]

            WindowsAPIAdapter.Stop();
            Log.CloseAndFlush();

SoundSwitch/Program.cs[194-195]

        WindowsAPIAdapter.Stop();
        MMNotificationClient.Instance?.Dispose();
Behavioral complexity 🟢 Low 🧩 Straightforward

  • Before: the compile-time branch selected Verbose for Debug and non-RELEASE configurations, and Debug for RELEASE.
  • After: DEBUG selects Verbose and every other configuration selects Information; additionally, Stop() classifies ObjectDisposedException as the documented benign race and routes other exceptions through the existing Warning logging API.
  • New correctness condition: configuration constants must continue to correspond to the intended verbosity policy, the expected disposal race must remain contained, and unexpected Stop() exceptions must remain visible without changing shutdown control flow.
  • These are direct threshold and exception-classification rules using the existing Serilog and catch infrastructure; no new transformation, compatibility protocol, coordinated invariant, concurrency behavior, or state transition is introduced.
Sources

SoundSwitch/Framework/Logger/Configuration/LoggerConfigurator.cs[21-24]

#if DEBUG
            .MinimumLevel.Verbose()
#else
            .MinimumLevel.Information()

SoundSwitch/Program.cs[119-120]

            WindowsAPIAdapter.Stop();
            Log.CloseAndFlush();

SoundSwitch/Program.cs[194-195]

        WindowsAPIAdapter.Stop();
        MMNotificationClient.Instance?.Dispose();
Potential damage 🟡 Medium 🩹 Recoverable

  • The concrete failure remains reduced diagnostic information, not loss or corruption of application state or the user's audio-switching capability.
  • The follow-up improves one previously vulnerable path: unexpected Stop() exceptions remain visible at Warning in shipped logs, while the documented disposal race remains intentionally silent.
  • The broader global floor still removes Debug/Verbose records from local logs and Serilog-derived Sentry breadcrumbs.
  • Reverting the build or redeploying the prior logger configuration restores future capture, but it cannot recreate records already filtered or already-sent breadcrumb context.
  • The file-log and Sentry-context capabilities have equal consequence and remain grouped under the same bounded shipped-observability scope.
  • Recoverable by restoring the prior logger configuration and redeploying/restarting affected builds.
  • Existing persisted log files remain exportable, Information+/Warning/Error telemetry continues during the affected period, and unexpected Stop() exceptions are now visible as Warning events.
  • Missing Debug/Verbose records and already-sent Sentry context require reproduction or a later diagnostic capture; there is no automatic state-repair or external-effect compensation path.
Sources

SoundSwitch/Framework/Logger/Configuration/LoggerConfigurator.cs[21-24]

#if DEBUG
            .MinimumLevel.Verbose()
#else
            .MinimumLevel.Information()

SoundSwitch/Program.cs[119-120]

            WindowsAPIAdapter.Stop();
            Log.CloseAndFlush();

SoundSwitch/Program.cs[194-195]

        WindowsAPIAdapter.Stop();
        MMNotificationClient.Instance?.Dispose();
Assessed commit b32d69e
Diagram

graph TD
  Debug["Debug build"] --> Gate{"DEBUG defined?"} -->|"Verbose"| Console["Console sink"]
  Shipped["Shipped builds"] --> Gate -->|"Info or above"| File["Rolling log"]
  Gate -->|"Filtered events"| Sentry["Sentry sink"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Filter only the shipped file sink
  • ➕ Could retain Debug-level events as Sentry breadcrumbs in shipped builds.
  • ➖ Requires separate global and sink-level policies, retaining processing of noisy Debug events.
  • ➖ Does not match the documented goal of an Information floor across the shipped pipeline.

Recommendation: Keep the PR’s single global DEBUG gate. It fixes all three shipped configurations without maintaining source-specific filters; the tradeoff is that shipped Sentry breadcrumbs also become effectively Information+, while Error events remain unaffected.

Files changed (2) +186 / -3

Bug fix (1) +3 / -3
LoggerConfigurator.csSelect Serilog’s minimum level using DEBUG +3/-3

Select Serilog’s minimum level using DEBUG

• Debug builds retain Verbose logging, while Release, Beta, and Nightly now require Information or above. The global filter applies before the existing file and Sentry sinks; their settings and the Debug-only console sink are unchanged.

SoundSwitch/Framework/Logger/Configuration/LoggerConfigurator.cs

Documentation (1) +183 / -0
2026-11-18-release-log-levels.mdDocument the shipped-build logging policy +183/-0

Document the shipped-build logging policy

• Records the configuration mismatch, expected levels, and audit of diagnostics that the new floor suppresses. It also explains the Sentry breadcrumb tradeoff, rejected alternatives, and manual validation steps.

docs/design/logging/2026-11-18-release-log-levels.md

@qodo-code-review

qodo-code-review Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (5) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Shipped Sentry error reports lose Debug breadcrumbs 🐞 Bug ◔ Observability
Description
Raising the global MinimumLevel to Information in ConfigureLogger makes the Sentry sink's
o.MinimumBreadcrumbLevel = LogEventLevel.Debug setting ineffective in Release, Beta and Nightly,
because Serilog drops events before any sink sees them. Any Debug or Verbose event that would have
been a breadcrumb attached to a shipped Sentry error event is now never created, so crash and error
reports from users lose the diagnostic trail that preceded them.
Code

SoundSwitch/Framework/Logger/Configuration/LoggerConfigurator.cs[R23-24]

+#else
+            .MinimumLevel.Information()
Relevance

●● Moderate

Deliberate, ADR-documented tradeoff; no close rejection or acceptance precedent for global level
gating Sentry breadcrumbs.

PR-#2571

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The global level gates all sinks, so the Sentry breadcrumb setting cannot restore events the
pipeline dropped. The trade-off is documented, but it removes the context that surrounds error
events for every shipped user, not only the noisy per-PID chatter the PR targets.

SoundSwitch/Framework/Logger/Configuration/LoggerConfigurator.cs[21-40]
docs/design/logging/2026-11-18-release-log-levels.md[95-103]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The global Serilog minimum level in `LoggerConfigurator.ConfigureLogger` is now Information for non-DEBUG builds. This silently drops Debug breadcrumbs from Sentry, and the `MinimumBreadcrumbLevel = Debug` setting becomes dead configuration in shipped builds.
## Fix Focus Areas
- SoundSwitch/Framework/Logger/Configuration/LoggerConfigurator.cs[21-40]
## Recommended Fix
Either (a) keep the global minimum at Debug for shipped builds and move the Information floor onto the file sink with `restrictedToMinimumLevel: LogEventLevel.Information`, so Sentry keeps its Debug breadcrumbs, or (b) if the Information floor stays global, set `MinimumBreadcrumbLevel` to Information so the configuration matches what actually reaches Sentry, and update the ADR to say so.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Failed audio-route clears lose their cause ✓ Resolved
Description
ClearDefaultEndPoint catches a failed endpoint write and records its exception only at Debug,
which the new shipped-build minimum discards. When Windows rejects a clear, the caller receives only
false and can remove the assignment ledger entry after deleting its persisted record, leaving no
exception in the shipped log to explain why the live route was not cleared.

3. Pipe teardown failures leave no traceback ✓ Resolved
Description
ClientConnectedAsync and DisposeStreamAsync catch unexpected pipe-handling and disposal
exceptions but record them only at Debug, which the new shipped-build minimum filters out. If a
connection handler escapes its inner error handling or stream disposal fails, the catches suppress
those exceptions without retaining their causes in the shipped log.

View medium (4)
4. Shipped Sentry error reports lose Debug breadcrumbs 🐞 Bug ◔ Observability
Description
Raising the global MinimumLevel to Information in ConfigureLogger makes the Sentry sink's
o.MinimumBreadcrumbLevel = LogEventLevel.Debug setting ineffective in Release, Beta and Nightly,
because Serilog drops events before any sink sees them. Any Debug or Verbose event that would have
been a breadcrumb attached to a shipped Sentry error event is now never created, so crash and error
reports from users lose the diagnostic trail that preceded them.
Code

SoundSwitch/Framework/Logger/Configuration/LoggerConfigurator.cs[R23-24]

+#else
+            .MinimumLevel.Information()
Relevance

●● Moderate

Deliberate, ADR-documented tradeoff; no close rejection or acceptance precedent for global level
gating Sentry breadcrumbs.

PR-#2571

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The global level gates all sinks, so the Sentry breadcrumb setting cannot restore events the
pipeline dropped. The trade-off is documented, but it removes the context that surrounds error
events for every shipped user, not only the noisy per-PID chatter the PR targets.

SoundSwitch/Framework/Logger/Configuration/LoggerConfigurator.cs[21-40]
docs/design/logging/2026-11-18-release-log-levels.md[95-103]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The global Serilog minimum level in `LoggerConfigurator.ConfigureLogger` is now Information for non-DEBUG builds. This silently drops Debug breadcrumbs from Sentry, and the `MinimumBreadcrumbLevel = Debug` setting becomes dead configuration in shipped builds.
## Fix Focus Areas
- SoundSwitch/Framework/Logger/Configuration/LoggerConfigurator.cs[21-40]
## Recommended Fix
Either (a) keep the global minimum at Debug for shipped builds and move the Information floor onto the file sink with `restrictedToMinimumLevel: LogEventLevel.Information`, so Sentry keeps its Debug breadcrumbs, or (b) if the Information floor stays global, set `MinimumBreadcrumbLevel` to Information so the configuration matches what actually reaches Sentry, and update the ADR to say so.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


5. Failed audio-route clears lose their cause 🐞 Bug ◔ Observability
Description
ClearDefaultEndPoint catches a failed endpoint write and records its exception only at Debug,
which the new shipped-build minimum discards. When Windows rejects a clear, the caller receives only
false and can remove the assignment ledger entry after deleting its persisted record, leaving no
exception in the shipped log to explain why the live route was not cleared.
Code

SoundSwitch/Framework/Logger/Configuration/LoggerConfigurator.cs[24]

+            .MinimumLevel.Information()
Evidence
The new global minimum filters the exception-bearing Debug event. The clear's boolean result passes
through AudioSwitcher to the reconciler, which may remove the ledger entry after deleting a record
even when the live-session clear was not accepted.

SoundSwitch/Framework/Logger/Configuration/LoggerConfigurator.cs[20-25]
SoundSwitch.Audio.Manager/Interop/Client/ExtendedPolicyClient.cs[142-171]
SoundSwitch.Audio.Manager/AudioSwitcher.cs[436-442]
SoundSwitch/Services/AppRuleAssignmentReconciler.cs[500-530]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Shipped builds discard the only exception log for failed per-app endpoint clears, even though the failure can leave a live process on its old route.
## Fix Focus Areas
- SoundSwitch.Audio.Manager/Interop/Client/ExtendedPolicyClient.cs[155-168]
- SoundSwitch/Framework/Logger/Configuration/LoggerConfigurator.cs[21-25]
## Recommended Fix
Log genuine endpoint-write exceptions at Warning or higher while leaving the expected no-audio-session diagnostic at Debug. Keep the shipped Information minimum.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


6. Pipe teardown failures leave no traceback 🐞 Bug ◔ Observability
Description
ClientConnectedAsync and DisposeStreamAsync catch unexpected pipe-handling and disposal
exceptions but record them only at Debug, which the new shipped-build minimum filters out. If a
connection handler escapes its inner error handling or stream disposal fails, the catches suppress
those exceptions without retaining their causes in the shipped log.
Code

SoundSwitch/Framework/Logger/Configuration/LoggerConfigurator.cs[24]

+            .MinimumLevel.Information()
Evidence
The outer handler catch and disposal catch each swallow an exception after a Debug-only log. Unlike
ordinary communication exceptions logged at Error inside the request loop, an exception reaching
either of these catches has no corresponding higher-level traceback.

SoundSwitch/Framework/Logger/Configuration/LoggerConfigurator.cs[20-25]
SoundSwitch.IPC/Pipe/NamedPipe.cs[218-229]
SoundSwitch.IPC/Pipe/NamedPipe.cs[275-299]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The shipped Information minimum hides exceptions swallowed by the outer pipe-handler and stream-disposal catches.
## Fix Focus Areas
- SoundSwitch.IPC/Pipe/NamedPipe.cs[275-299]
- SoundSwitch/Framework/Logger/Configuration/LoggerConfigurator.cs[21-25]
## Recommended Fix
Raise the logs for unexpected handler escapes and disposal failures to Warning or Error with their exceptions. Leave expected broken-connection diagnostics at Debug and retain the shipped Information minimum.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


7. Shipped Sentry error reports lose Debug breadcrumbs 🐞 Bug ◔ Observability
Description
Raising the global MinimumLevel to Information in ConfigureLogger makes the Sentry sink's
o.MinimumBreadcrumbLevel = LogEventLevel.Debug setting ineffective in Release, Beta and Nightly,
because Serilog drops events before any sink sees them. Any Debug or Verbose event that would have
been a breadcrumb attached to a shipped Sentry error event is now never created, so crash and error
reports from users lose the diagnostic trail that preceded them.
Code

SoundSwitch/Framework/Logger/Configuration/LoggerConfigurator.cs[R23-24]

+#else
+            .MinimumLevel.Information()
Relevance

●● Moderate

Deliberate, ADR-documented tradeoff; no close rejection or acceptance precedent for global level
gating Sentry breadcrumbs.

PR-#2571

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The global level gates all sinks, so the Sentry breadcrumb setting cannot restore events the
pipeline dropped. The trade-off is documented, but it removes the context that surrounds error
events for every shipped user, not only the noisy per-PID chatter the PR targets.

SoundSwitch/Framework/Logger/Configuration/LoggerConfigurator.cs[21-40]
docs/design/logging/2026-11-18-release-log-levels.md[95-103]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The global Serilog minimum level in `LoggerConfigurator.ConfigureLogger` is now Information for non-DEBUG builds. This silently drops Debug breadcrumbs from Sentry, and the `MinimumBreadcrumbLevel = Debug` setting becomes dead configuration in shipped builds.
## Fix Focus Areas
- SoundSwitch/Framework/Logger/Configuration/LoggerConfigurator.cs[21-40]
## Recommended Fix
Either (a) keep the global minimum at Debug for shipped builds and move the Information floor onto the file sink with `restrictedToMinimumLevel: LogEventLevel.Information`, so Sentry keeps its Debug breadcrumbs, or (b) if the Information floor stays global, set `MinimumBreadcrumbLevel` to Information so the configuration matches what actually reaches Sentry, and update the ADR to say so.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational

8. Trace-routed diagnostics vanish from shipped logs ✓ Resolved
Description
Trace.WriteLine calls in WindowsAPIAdapter are routed through SerilogTraceListener to Serilog
Debug, so with the new Information floor they are dropped in Release, Beta and Nightly. The catch in
WindowsAPIAdapter is a broad catch (Exception ex), so any exception other than the expected
dispose race is now silently swallowed in shipped builds.

9. Trace-routed diagnostics vanish from shipped logs ✓ Resolved
Description
Trace.WriteLine calls in WindowsAPIAdapter are routed through SerilogTraceListener to Serilog
Debug, so with the new Information floor they are dropped in Release, Beta and Nightly. The catch in
WindowsAPIAdapter is a broad catch (Exception ex), so any exception other than the expected
dispose race is now silently swallowed in shipped builds.

10. Trace-routed diagnostics vanish from shipped logs ✓ Resolved

Resolving commit: b32d69e

Resolution reason
The broad catch in WindowsAPIAdapter.Stop() is narrowed to catch ObjectDisposedException (silently
absorbed as the documented benign race), and any other exception is now logged via Log.Warning(ex,
...) instead of Trace.WriteLine. Unexpected exceptions therefore stay visible in shipped builds. The
ADR was updated to document this promotion. The fix differs from the suggested prompt only in that
it narrows to ObjectDisposedException rather than logging all exceptions at Warning, which is a
valid alternative the finding itself offers.
Description
Trace.WriteLine calls in WindowsAPIAdapter are routed through SerilogTraceListener to Serilog
Debug, so with the new Information floor they are dropped in Release, Beta and Nightly. The catch in
WindowsAPIAdapter is a broad catch (Exception ex), so any exception other than the expected
dispose race is now silently swallowed in shipped builds.

Grey Divider

Tip of the day
💡 Did you know, you can describe a rule in plain language on the Rules page and Qodo drafts it for you

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (4) 📘 Rule violations (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Failed audio-route clears lose their cause 🐞 Bug ◔ Observability ⭐ New
Description
ClearDefaultEndPoint catches a failed endpoint write and records its exception only at Debug,
which the new shipped-build minimum discards. When Windows rejects a clear, the caller receives only
false and can remove the assignment ledger entry after deleting its persisted record, leaving no
exception in the shipped log to explain why the live route was not cleared.
Code

SoundSwitch/Framework/Logger/Configuration/LoggerConfigurator.cs[24]

+            .MinimumLevel.Information()
Evidence
The new global minimum filters the exception-bearing Debug event. The clear's boolean result passes
through AudioSwitcher to the reconciler, which may remove the ledger entry after deleting a record
even when the live-session clear was not accepted.

SoundSwitch/Framework/Logger/Configuration/LoggerConfigurator.cs[20-25]
SoundSwitch.Audio.Manager/Interop/Client/ExtendedPolicyClient.cs[142-171]
SoundSwitch.Audio.Manager/AudioSwitcher.cs[436-442]
SoundSwitch/Services/AppRuleAssignmentReconciler.cs[500-530]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Shipped builds discard the only exception log for failed per-app endpoint clears, even though the failure can leave a live process on its old route.

## Fix Focus Areas
- SoundSwitch.Audio.Manager/Interop/Client/ExtendedPolicyClient.cs[155-168]
- SoundSwitch/Framework/Logger/Configuration/LoggerConfigurator.cs[21-25]

## Recommended Fix
Log genuine endpoint-write exceptions at Warning or higher while leaving the expected no-audio-session diagnostic at Debug. Keep the shipped Information minimum.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Pipe teardown failures leave no traceback 🐞 Bug ◔ Observability ⭐ New
Description
ClientConnectedAsync and DisposeStreamAsync catch unexpected pipe-handling and disposal
exceptions but record them only at Debug, which the new shipped-build minimum filters out. If a
connection handler escapes its inner error handling or stream disposal fails, the catches suppress
those exceptions without retaining their causes in the shipped log.
Code

SoundSwitch/Framework/Logger/Configuration/LoggerConfigurator.cs[24]

+            .MinimumLevel.Information()
Evidence
The outer handler catch and disposal catch each swallow an exception after a Debug-only log. Unlike
ordinary communication exceptions logged at Error inside the request loop, an exception reaching
either of these catches has no corresponding higher-level traceback.

SoundSwitch/Framework/Logger/Configuration/LoggerConfigurator.cs[20-25]
SoundSwitch.IPC/Pipe/NamedPipe.cs[218-229]
SoundSwitch.IPC/Pipe/NamedPipe.cs[275-299]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The shipped Information minimum hides exceptions swallowed by the outer pipe-handler and stream-disposal catches.

## Fix Focus Areas
- SoundSwitch.IPC/Pipe/NamedPipe.cs[275-299]
- SoundSwitch/Framework/Logger/Configuration/LoggerConfigurator.cs[21-25]

## Recommended Fix
Raise the logs for unexpected handler escapes and disposal failures to Warning or Error with their exceptions. Leave expected broken-connection diagnostics at Debug and retain the shipped Information minimum.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Shipped Sentry error reports lose Debug breadcrumbs 🐞 Bug ◔ Observability
Description
Raising the global MinimumLevel to Information in ConfigureLogger makes the Sentry sink's
o.MinimumBreadcrumbLevel = LogEventLevel.Debug setting ineffective in Release, Beta and Nightly,
because Serilog drops events before any sink sees them. Any Debug or Verbose event that would have
been a breadcrumb attached to a shipped Sentry error event is now never created, so crash and error
reports from users lose the diagnostic trail that preceded them.
Code

SoundSwitch/Framework/Logger/Configuration/LoggerConfigurator.cs[R23-24]

+#else
+            .MinimumLevel.Information()
Relevance

●● Moderate

Deliberate, ADR-documented tradeoff; no close rejection or acceptance precedent for global level
gating Sentry breadcrumbs.

PR-#2571

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The global level gates all sinks, so the Sentry breadcrumb setting cannot restore events the
pipeline dropped. The trade-off is documented, but it removes the context that surrounds error
events for every shipped user, not only the noisy per-PID chatter the PR targets.

SoundSwitch/Framework/Logger/Configuration/LoggerConfigurator.cs[21-40]
docs/design/logging/2026-11-18-release-log-levels.md[95-103]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The global Serilog minimum level in `LoggerConfigurator.ConfigureLogger` is now Information for non-DEBUG builds. This silently drops Debug breadcrumbs from Sentry, and the `MinimumBreadcrumbLevel = Debug` setting becomes dead configuration in shipped builds.
## Fix Focus Areas
- SoundSwitch/Framework/Logger/Configuration/LoggerConfigurator.cs[21-40]
## Recommended Fix
Either (a) keep the global minimum at Debug for shipped builds and move the Information floor onto the file sink with `restrictedToMinimumLevel: LogEventLevel.Information`, so Sentry keeps its Debug breadcrumbs, or (b) if the Information floor stays global, set `MinimumBreadcrumbLevel` to Information so the configuration matches what actually reaches Sentry, and update the ADR to say so.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational

4. Trace-routed diagnostics vanish from shipped logs 🐞 Bug ◔ Observability
Description
Trace.WriteLine calls in WindowsAPIAdapter are routed through SerilogTraceListener to Serilog
Debug, so with the new Information floor they are dropped in Release, Beta and Nightly. The catch in
WindowsAPIAdapter is a broad catch (Exception ex), so any exception other than the expected
dispose race is now silently swallowed in shipped builds.
Code

SoundSwitch/Framework/Logger/Configuration/LoggerConfigurator.cs[R23-24]

+#else
+            .MinimumLevel.Information()
Relevance

●● Moderate

Concern about swallowed unexpected exceptions has some accepted precedent (PR #2371), but the
Trace.WriteLine demotion is explicitly covered by the ADR; no close match.

PR-#2371
PR-#2571

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The ADR's benign classification rests on the catch's comment, not on the exception types the catch
can receive. The PR's level change removes the only record of any unexpected exception thrown during
EndForm.

SoundSwitch/Framework/WinApi/WindowsAPIAdapter.cs[131-145]
docs/design/logging/2026-11-18-release-log-levels.md[86-94]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The broad catch in `WindowsAPIAdapter` reports via `Trace.WriteLine`, which is Debug-level under SerilogTraceListener. The PR's Information floor drops it in shipped builds, so unexpected exceptions are silently swallowed.
## Fix Focus Areas
- SoundSwitch/Framework/WinApi/WindowsAPIAdapter.cs[131-145]
## Recommended Fix
Replace `Trace.WriteLine("Thread Race Condition: " + ex)` with `Log.Warning(ex, "Thread race while stopping WindowsAPIAdapter form")` (or narrow the catch to `ObjectDisposedException`/`InvalidOperationException` and log other exceptions at Warning or above), so the diagnostic survives the Information floor.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context sources
✅ Compliance rules (platform): 45 rules
✅ Skills: 4 invoked
  end-to-end-testing
  mute-target-testing
  feature-test-authoring
  app-rules-testing
✅ Cross-repo context — repo relationships
Review mode: Auto: ⚖️ Balanced: Runtime logging policy changes affect shipped builds and multiple sinks.

Grey Divider

Tip of the day
💡 Did you know, you can describe a rule in plain language on the Rules page and Qodo drafts it for you

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

… in shipped logs

SerilogTraceListener maps Trace.WriteLine to Serilog Debug, so the
Information floor would have made the broad catch in
WindowsAPIAdapter.Stop() swallow unexpected exceptions silently in
shipped builds. Narrow the catch: the documented ObjectDisposedException
dispose race stays silent as before; anything else now logs at Warning.
Control flow is unchanged - both branches swallow, only logging differs.

ADR 2026-11-18 updated in place (§6.2, files touched, decision 4).
@kody-ai

kody-ai Bot commented Nov 19, 2026

Copy link
Copy Markdown

PR Summary (Comment created by Kody 🤖)

Code Review Started! 🚀

✋ Hi, team! I'm already looking at the changed files and starting the review to ensure everything is in order. If you need more details, I'm here! Kody

📂 Changed Files
File Status ➕ Additions ➖ Deletions 🔄 Changes
SoundSwitch/Framework/Logger/Configuration/LoggerConfigurator.cs modified 3 3 6
SoundSwitch/Framework/WinApi/WindowsAPIAdapter.cs modified 7 2 9
docs/design/logging/2026-11-18-release-log-levels.md added 195 0 195
📊 Summary of Changes
  • Total Files: 3
  • Total Lines Added: 205
  • Total Lines Removed: 5
  • Total Changes: 210

​

@Belphemur
Belphemur merged commit 1542b4f into dev Nov 19, 2026
14 of 15 checks passed
@Belphemur
Belphemur deleted the fix/release-log-levels branch November 19, 2026 03:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant