Open zoell opened 5 years ago
Hi,
I am looking for a way to add the Session ID to every log4j log entry.
Currently I am trying the MDC like this: <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %-5p %X{sessionId} %c:%L - %m%n" />
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %-5p %X{sessionId} %c:%L - %m%n" />
And in my code:
post("/process", (request, response) -> { response.type("application/json"); MDC.put("sessionId", request.session().id()); logger.debug("process request")); DoSomethings(); return new Gson().toJson(new StandardResponse(StatusResponse.SUCCESS)); });
In my DoSomething() I do many kind of async processing but in that class it seems this session Id is mixed across sessions, like it becomes a global variable.
What is the practical way to do this with Spark?
Thanks, zoell
Hi,
I am looking for a way to add the Session ID to every log4j log entry.
Currently I am trying the MDC like this:
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %-5p %X{sessionId} %c:%L - %m%n" />
And in my code:
In my DoSomething() I do many kind of async processing but in that class it seems this session Id is mixed across sessions, like it becomes a global variable.
What is the practical way to do this with Spark?
Thanks, zoell