KAFKA-18066: Fix mismatched StreamThread ID in log messages #19517
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes an issue where the thread name shown in log messages did not match the actual execution context. Previously, log entries displayed the context of the newly created thread, while the logger reflected the current executing thread. This mismatch led to confusion and made log tracing more difficult.
Logs before fix:
18:20:42.861 [main] INFO o.a.k.s.p.internals.StreamThread - stream-thread [streams-linesplit-68754e82-1561-4482-a6cb-9f4b486c84ca-StreamThread-1] Creating restore consumer client
18:20:42.969 [main] INFO o.a.k.s.p.internals.StreamThread - stream-thread [streams-linesplit-68754e82-1561-4482-a6cb-9f4b486c84ca-StreamThread-1] Creating consumer client
Logs after fix:
18:33:02.098 [main] INFO o.a.k.s.p.internals.StreamThread - Creating restore consumer client for thread streams-linesplit-b7f8e5ab-841c-4fc9-8902-7fe9c9c06f55-StreamThread-1
18:33:02.214 [main] INFO o.a.k.s.p.internals.StreamThread - Creating consumer client for thread streams-linesplit-b7f8e5ab-841c-4fc9-8902-7fe9c9c06f55-StreamThread-1
Changes: