playframework / playframework/playframework
Set log MDC on new Threads
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 12.6k
- Forks
- 4k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 29
Description
Hi team,
It would be very helpful to have the log MDC copied to new threads, the same way the HttpContext is today.
This way we can easily keep track logs originated on a specific request. Current the MDC values are lost when using async operations like WS API handleAsync().
It should be a simple change. I can submit a MR if you guys agree with this change.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with framework/src/play/src/main/scala/play/core/j/HttpExecutionContext.scala at the referenced lines, and trace how HttpContext is propagated to new threads. Check how async operations such as WS API handleAsync() create or use execution contexts. Done means MDC values remain available in logs produced by work on those new threads.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- backend, observability
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100