feat(worker): log exception messages and per-command start/end (mxaccessgw#184)

R21-O3: WorkerApplication.Run's failure lines logged only the exception
type. Each now also carries exception_message, scrubbed by the new
WorkerLogRedactor.RedactMessage: the value of any name=value / name: value
pair whose name looks sensitive and any mxgw_ API key token are replaced,
line breaks are flattened and the text is capped at 512 characters. The
AppDomain unhandled-exception hook stays type-only, since an exception
from an arbitrary thread can carry command values.

R21-O7: StaCommandDispatcher.ExecuteQueuedCommandAsync logs
WorkerCommandStarted (correlation id, method, queued_ms) and
WorkerCommandCompleted (status, HRESULT, elapsed_ms) when a CommandLogger
is set. IWorkerLogger has no Debug level, so the lines are opt-in through
MXGATEWAY_WORKER_LOG_COMMANDS=1|true (WorkerCommandLogging), which the
worker inherits from the gateway process environment. No payloads or
diagnostic messages are logged. Docs updated. (mxaccessgw#184)

Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
This commit is contained in:
Joseph Doherty
2026-11-09 12:56:29 -05:00
parent f49b7a0cc1
commit d9c60a78eb
11 changed files with 365 additions and 12 deletions
+3 -1
View File
@@ -1162,7 +1162,9 @@ Worker logs should include:
- protocol version,
- gateway handshake result,
- MXAccess COM creation result,
- command start/end with correlation id,
- command start/end with correlation id (`WorkerCommandStarted` /
`WorkerCommandCompleted`, opt-in through `MXGATEWAY_WORKER_LOG_COMMANDS`; see
`docs/WorkerBootstrap.md`),
- HRESULT/status summary,
- event family and sequence,
- queue overflow,