In order to be able to analyze logs of complex processes for your application, it is useful to use Mapped Diagnostic Context (MDC) and put some process specific information into it. Currently, I am implementing a Spring Boot application with several services and lots of calls between them. As there is a huge number of users parallel, when it comes to analyzing a production log, it is not easy to find the subsequent process calls, belonging to a REST call in the log file.
In order to make my life easier, there is still a unique session ID in the log, using MDC, to find all the calls belonging to a specific user and call. But, to make the analysis easier, I decided to add function-specific information to the logs. So, if a REST method gets called, it can set the logical function name in the MDC. Therefore, all later calls to the helper or DAO classes can be logged with the same function name and can be found easily.
from DZone.com Feed https://ift.tt/2PzndHn
No comments:
Post a Comment