Summary
Make logging thread-safe and per-run scoped, so concurrent target execution (FT-8) is safe. Prerequisite for parallelism.
Findings (file:line)
Logging.cs:214 — InMemorySink.Instance with an unlocked List<LogEvent> (_logEvents); concurrent emits race.
Logging.cs:239-243 — target-context enricher uses a static s_property (SetAndRestore), not safe under concurrent targets.
Logging.cs:20 — global LevelSwitch; per-run level should live on the context.
Scope
- Lock or use a concurrent collection for
InMemorySink.
- Replace the enricher's static
s_property with AsyncLocal so per-target context is correct under concurrency.
- Per-run level switch held on
BuildContext.Logging.
Acceptance criteria
- Concurrent emits don't race (stress test).
- Per-target log context is correct under parallel execution.
Notes
- Non-breaking.
- Depends on: FT-2. Prerequisite for: FT-8.
- Size: M.
Summary
Make logging thread-safe and per-run scoped, so concurrent target execution (FT-8) is safe. Prerequisite for parallelism.
Findings (file:line)
Logging.cs:214—InMemorySink.Instancewith an unlockedList<LogEvent>(_logEvents); concurrent emits race.Logging.cs:239-243— target-context enricher uses a statics_property(SetAndRestore), not safe under concurrent targets.Logging.cs:20— globalLevelSwitch; per-run level should live on the context.Scope
InMemorySink.s_propertywithAsyncLocalso per-target context is correct under concurrency.BuildContext.Logging.Acceptance criteria
Notes