I have added Logger in my code at serveral places (Log4j). Like Logger.info(" some thing "); My log is something like this at so many places,
Timestamp LogLevel SometText SomeMoreText
Whenever any new request comes, I want to add some value like ID:CurrentValuetime in every logLevel which will be same till the request is there to all LogLevel so my logs should be like
Timestamp LogLevel ID:CurrentValuetime SometText SomeMoreText
ID:CurrentValuetime Should be same at all places it should be global and final which should get appended automatically to all loglevel
How can I achieve this ?
Achieved it with the help of MDC
Created a servlet filter and with the help of
I was able to add unique value into log at once.
And remove value once request is complete