Repository navigation
fix(logging): ship Information-level logs in Release/Beta/Nightly builds - #2611
Conversation
…d builds at Information)
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.
Code Review Could Not Complete
|
| Options | Enabled |
|---|---|
| Bug | ✅ |
| Performance | ✅ |
| Security | ✅ |
| Business Logic | ✅ |
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
PR Summary by QodoKeep debug logs out of shipped builds
AI Description
Merge Risk
|
Code Review by Qodo
1. Shipped Sentry error reports lose Debug breadcrumbs
|
Code Review by Qodo
1. Failed audio-route clears lose their cause
|
… 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).
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
📊 Summary of Changes
|
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.cskeyed the Serilog pipeline minimum level onRELEASE:But the csproj configurations do not all define
RELEASE:DefineConstantsTRACE;DEBUGRELEASETRACE;BETA#else)TRACE;NIGHTLY#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:Informationminimum — shipped logs now contain switch events (Set Default device: …), app-rule matches, profile triggers, warnings, and errors; no per-PID access-denied chatter._logger.Debugcall-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 alreadyInformation.#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 (WindowsAPIAdapterthread-race notes,AudioSwitcher"Default endpoint already …" no-op skips).Design decision record:
docs/design/logging/2026-11-18-release-log-levels.md.Validation
dotnet build SoundSwitch/SoundSwitch.csproj -c <cfg> -p:LinuxBuild=true -p:BuildProjectReferences=false→ 0 errors (4 pre-existing warnings, untouched files).grep -rn "MinimumLevel" SoundSwitch/shows only the new policy;git diffreview confirms no_logger.Debugcall sites touched.