-
Notifications
You must be signed in to change notification settings - Fork 238
Description
If I include a %X
in my pattern layout, I see that the following appears in my log output
... { AWSRequestId=4e145840-092b-11e8-a601-a9957c1b507d}...
I don't see anything in this library that sets ThreadContext, so I am unsure if this is somehow being set by the Lambda runtime or by some other log4j2 mechanism I am not aware of.
While this value appears to be correct in the main thread, I have noticed that other threads such as in a fork join pool will have this value populated, but often incorrectly (in the case of container re-use, it will retain the value of a previous invocation/request Id). Usually some of the threads have correct IDs while others have stale/old/incorrect IDs: I think the behavior is the request ID is set once the first time the thread is used in a container, but after the thread has been spawned the request ID in the child threads never get updated again, so they retain the request ID of whatever invocation was the first to use/spawn that particular thread.
What library/entity owns setting this request ID and how can I get this to be correct for multi-threaded applications?