I would like to add TraceId to all log lines. I do that easily by:
- Add traceId to MDC
MDC.put("TRACE_ID", sessionAware.getTraceId()+": ");
- Update file-pattern in my application.properties (by adding: "%X{TRACE_ID}"):
logging.pattern.file=-%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}} ${LOG_LEVEL_PATTERN:-%5p} ${PID:- } --- [%t] %-40.40logger{39} : %X{TRACE_ID}%m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}
But I would like my CustomSpringBootStarter to set the file pattern. But it doesn't take effect when I update property "logging.pattern.file" from my CustomSpringBootStarter. Does anyone know the solution to this problem?
I have tried to set the "logging.pattern.file" property in the CustomSpringBootStarter's application.properties but it does not work.