1

I have set key-value pairs in MDC like

MDC.put("userid", 1);
MDC.put("email", "abc@com");
Logger.info("log statement");

I see that logs sometimes printed with userid=1, email=abc@com and sometimes email=abc@com, userid=1. I see it uses an internal hashmap. Is there any way to maintain the ordering of key-value pairs so that logs are printed consistently in order?

Thank you

Salman
  • 127
  • 1
  • 10

0 Answers0