Thus, we use a single state context context with a correlation identifier for centralized logging. The goal is to track the identifier throughout our process and map different levels.
Access to the state context is done by several DLLs and several users.
The difficulty arises when multithreading comes into play:
- Process 1 started by user 1
- The correlation identifier is set to {1}
- DLL A gets the state context and gets the correlation identifier {1}
- Until process 1 is complete, process 2 is fired by user 2
- The correlation identifier is set to {2}
- DLL B from the context of the state of access to the process with the correlation identifier {2}, when it should be {1}
How to solve this problem?
We do not perceive blocking as our decision? Any other ideas?
Here is a chart
(S)->[ CorrelationID {get;set} ]
^ ^ ^
U1 <--> | | | O
U2 <--> [DLLA] <--> [DLLB] <--> [DLLC] <--> | |
U3 <-->
{Web} <--> {Domain} <-> {Data Access} <--> {DB}
(<-- Process / Thread --> )
{} = Examples of possible DLLs
Each user process must have 1 correlation identifier
source
share