Add LoggingContext.withContext for safe ThreadContext management#97
Add LoggingContext.withContext for safe ThreadContext management#97SpaceLeam wants to merge 3 commits into
Conversation
|
@pjfanning, would you mind helping with the review of this PR, please? |
|
@vy the code seems ok to me - the only thing I would suggest is that the withContext methods could have I guess the main problem is that the CI is busted because the action versions are out of date. |
|
@pjfanning, would you be interested in submitting a PR bumping the |
|
@SpaceLeam, could you implement the following changes, please?
|
I'm afraid that I don't know much about the CI setup used by log4j team and I am not even really a user of log4j. |
…s and changelog
f908de2 to
41e9329
Compare
Status Update: Ready for Merge @vy I have completed all the requested changes. Summary of Changes:
Verification: Passed: The PR is updated and ready for review. |
aa4a160 to
addeb37
Compare
|
@SpaceLeam, would you also mind extending tests similar to CloseableThreadContextTest, please? See that there are several edge cases, and some burned our fingers in the past. Hence, feel free to copy the file as is and only change what is necessary to make it use the |
|
Hi @vy, Just pushed the updates. I've added the comprehensive tests covering nesting, restoration, and exception handling (essentially ported the edge cases from CloseableThreadContextTest as suggested). Verified the build locally and it's all green now (screenshot below). Btw, I'm open to helping out with other issues in this repo if you need an extra hand. Just let me know. |



Implements a functional wrapper (Loan Pattern) to ensure ThreadContext is automatically cleared after execution, preventing context leaks in asynchronous environments (e.g., Scala Futures).