Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

As a developer, I want the process id to be logged consistently in all thread contexts #304

Open
james-d-brown opened this issue Sep 4, 2024 · 1 comment

Comments

@james-d-brown
Copy link
Collaborator

Given that the process identifier is requested in the logback.xml
When I inspect the logging in a given context
Then the process identifier should appear on all log lines
So that I can distinguish/filter logging associated with a specific application instance (when there are two or more executing)

@james-d-brown
Copy link
Collaborator Author

Currently, log messages executed within threads owned by a ThreadPoolExecutor do not see and log the process identifier, which we share using MDC. Unfortunately, MDC is a very hacky solution and requires a special approach to ThreadPoolExecutor. A better, in-built approach would be ideal. Absent that (and I think there is an absence of that), further hacks may mitigate, like this:

https://medium.com/asyncparadigm/logging-in-a-multithreaded-environment-and-with-completablefuture-construct-using-mdc-1c34c691cef0

Very ugly, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant