Hello Vertx Google Group,
I would like to aggregate log events from our distributed Vertx application and be able to correlate as much logging output as possible based on an eventId we generate when an initial event (HTTP request, etc) enters the system and send along with every EventBus message as metadata.
The main problem I am finding is that I need to pass around the eventId, or a logger instance created from it to every part of my code which outputs any logging which is cumbersome and impossible in many places.
Typical MDC mechanisms don't work because they are based on Thread context, but in a Vertx application a request may be processed by multiple threads, and a single thread may process multiple requests concurrently. As far as I can see there is no such thing as a "vertx processing context" in which I can store data. Ideally I would like to be able to put data into such a context when a Message is received, and have any code executing as a result of that message have access to this state.
This feels like it must be a common problem but I am struggling to find a decent solution, I welcome any suggestions and would be happy to provide more context/info but am not sure what else would help at the present.
Kind regards,
James