Hey, first of thank you for developing this. I have an issue, I'm trying to get contextual logging working with a gateway application. I've tried several different solutions and failed since its either resource intensive (Spring Sleuth) or it can produce misleading results (https://www.novatec-gmbh.de/en/blog/how-can-the-mdc-context-be-used-in-the-reactive-spring-applications/. ( Correlation ids showing up in logs that were not triggered by my request but rather some background process that uses WebClient))
.
Ive wired up your solution and it does seem to add a correlation_id to the reactive context but the QudiniLogEvent
always has an empty context. Below is an example of a log line generated in the HttpWebHandlerAdapter
. Notice theres nothing in the MDC
{"timestamp":"2021-11-02T21:43:06.058Z","level":"DEBUG","message":"[9d56bc30-2, L:/0:0:0:0:0:0:0:1:8085 - R:/0:0:0:0:0:0:0:1:51859] HTTP GET \"/services/unified/v1/authn/.well-known/webfinger?resource=iampsrtenant-robin3&tenantAlias=IAMPSRTENANT288\"","build_version":"unknown","thread":"reactor-http-nio-6","logger":"org.springframework.web.server.adapter.HttpWebHandlerAdapter","env":"unknown"}
Do you know how to get this working for a project based of spring cloud gateway?
I've gotten it to where it will output
{"correlation_id":"dca04dc2-a4f1-4242-9932-dd1971948bda","timestamp":"2021-11-03T14:06:45.714Z","level":"INFO","message":"TESTTESTTEST","build_version":"unknown","thread":"reactor-http-nio-6","logger":"com.something.gateway.filters.CorrelationFilter","env":"unknown"}
However that is when the log statement is inside Log.thenMono. Is there any way to do this throughout the whole request chain? Starting at the httphandler?
https://spring.io/projects/spring-cloud-gateway#samples