Question

When a user sends a request to my web application, a user session id is added to the NDC stack to be used in the log4j log files, but for some reason, when I call another method, the session id doesn't seem to be in the log calls within that method. Though once that method has completed the rest of the process, still retains the session id within the log files.

I'm not too sure why this is happening and was wondering if anyone knows of why this may be or has any theories on the reason for loosing the session id?

Thanks for any help given.

Was it helpful?

Solution

NDCs are managed on a per-thread basis - that means that if you push the session ID onto the stack in one thread and then call a method in another thread your session ID won't be present.

It's hard for me to answer without the context of your code... If you post your code I could probably provide a specific answer.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top