-
Notifications
You must be signed in to change notification settings - Fork 443
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
Using Mapped Diagnostic Context (MDC) of a logging system for web socket controller #17
Comments
Part of the issue is the asynchronous hand-off at various points. The clientInboundChannel passes incoming messages to subscribers (e.g. SimpAnnotationMethodMessageHandler, SimpleBrokerMessageHandler, etc) asynchronously so one message is handled on multiple threads. A solution is not immediately obvious but It's worth giving it some thought, how to correlate all log statements related to the processing of a message whether it originated from outside or within the application. |
Thank you Rossen. I understand the cause of the problem. I just had a little expectation that there is an existing solution, because it is important for enterprise systems. |
Initial workaround:
|
This example is a little more focused actually. For something like that, you could extend |
It looks like there is no a good place to introduce an MDC interceptor to output in the log an unique identifier of the processed request/message.
In case of regular servlets it is available via javax.servlet.Filter. For example:
Probably it makes sense to provide somehow this functionality with WebSocketMessageBrokerConfigurer.
PS: it could be done with spring AOP but if there is a simpler solution it would be great.
The text was updated successfully, but these errors were encountered: