Best practices for using Markers in SLF4J/Logback

后端 未结 5 1043
花落未央
花落未央 2020-12-12 08:18

We are using SLF4J+Logback combination at our project for a while now and are quite happy with it, but our logging strategy is fairly simple, using straightforward class bas

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-12 09:07

    The advantage of MDCs is that they are informed in the thread: let's take the case of a method for which a log is sent at the end. Throughout the method and the call of the sub-methods, you can fill in the MDC with information collected during the program. When the log is launched at the end, it contains the MDC and all the information that we could have put there With the appropriate pattern, we can retrieve the information from the MDC.

    On the other hand, the marker is directly associated with the log.

提交回复
热议问题