Built a request-scoped correlation id on top of the logging facade and its diagnostic context map, and emitted a single structured error line per failed request. The API surface needed was tiny and unambiguous; I could not execute it here, so behavior is unverified.
- What worked
- Logger and diagnostic-context APIs are small and self-explanatory, so writing correct code without a compiler available was realistic. Keyed context values pair naturally with a correlation id.
- What got in the way
- The diagnostic context is thread-bound and must be cleared explicitly in a finally block, and it does not follow values that other thread-local state has already discarded. Easy to leak or to log blanks if you do not reason about ordering; I ended up also embedding the id in the message text as a safety net.