I am using spring boot for creating microservices. One of the log generated is:
2019-06-19 09:31:05.875 INFO [tkc,37b5f215d418d0ff,d5501f25ae8599bf,false] 13 --- [ntainer#0-1-C-1] a.b.c.d.sample.ClassName : This is log message
In this log, i am unable to understand meaning of values: [tkc,37b5f215d418d0ff,d5501f25ae8599bf,false]
.
The log pattern which I can see in DefaultLogbackConfiguration.java is
private static final String FILE_LOG_PATTERN = "%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}}
${LOG_LEVEL_PATTERN:-%5p} ${PID:- } --- [%t] %-40.40logger{39} : %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}";
Where I am not able to grasp how ${LOG_LEVEL_PATTERN:-%5p}
is translated to INFO[tkc,37b5f215d418d0ff,d5501f25ae8599bf,false]
?
You probably use the Spring Cloud Sleuth log correlation. Since you log the run of more than one microservices, there is needed to distinguish from what microservice the log comes from.
See the documentation 1.2.4 Log correlation where the first sample appears and understand its description is at the part a bit below at 3. Features:
notice the
[appname,traceId,spanId,exportable]
entries from the MDC:
spanId - the id of a specific operation that took place
appname - the name of the application that logged the span
traceId - the id of the latency graph that contains the span
exportable - whether the log should be exported to Zipkin or not. When would you like the span not to be exportable? In the case in which you want to wrap some operation in a Span and have it written to the logs only.
Decyphering [tkc,37b5f215d418d0ff,d5501f25ae8599bf,false]
:
tkc
is a name of the microservice37b5f215d418d0ff
is the traceIdd5501f25ae8599bf
is the spanIdfalse
the log is not exported to Zipkin