0

I have an Spring boot application running in tomcat 9.0.71. I have one custom Spring boot filer written, in which I have logged method's start and end log. I am not able to understand why the start-log time printed in catalina.out is greater and the end-log time. I am attaching the code snippet and the logs timeJava code snippet. Folowing are the logs printed with time:

[INFO ] 2024-07-03 00:51:25.754 [https-jsse-nio-443-exec-27] [980e4295-2ab6-c1b3-aabe-f23ebaba488d] CustomerFilter - Filter Starting... 1719949885754

[INFO ] 2024-07-03 00:51:24.655 [https-jsse-nio-443-exec-27] [980e4295-2ab6-c1b3-aabe-f23ebaba488d] CustomerFilter - Filter Ending... 1719949884655

Can anyone help me out, what could cause the time to be greater for (Filter Starting) than (Filter Ending)

3
  • Where are logs being written? Local filesystem, netwrok drive?
    – LMC
    Commented Jul 2 at 22:39
  • Logs are written in local file syetem (I mean the server where tomcat is installed, log files are written there.) Commented Jul 3 at 9:08
  • 1
    @LMC the issue is resolved after fixing the MDC value in highest order filter. Thanks for engaging for the solution. Commented 19 hours ago

1 Answer 1

0

I have found the solution. The issue was not related to logs order in my case. Actually the MDC value was not being reset due to my custom Springboot Filter's order (in my case the MDC thread value was 980e4295-2ab6-c1b3-aabe-f23ebaba488d). And I was capturing the logs with this value (980e4295-2ab6-c1b3-aabe-f23ebaba488d). This is resolved after setting MDC in highest order Springboot filter.

Not the answer you're looking for? Browse other questions tagged or ask your own question.