Spring Boot contains a quite nice configuration for logback with color coding and good readability. But it lacks logging MDC (Mapped Diagnostic Context) content. I tried around and found a way to append MDC to every logged line by setting the console pattern in my application.properties/yml under logging.pattern.console to
${CONSOLE_LOG_PATTERN:%clr(%d{${LOG_DATEFORMAT_PATTERN:yyyy-MM-dd HH:mm:ss.SSS}}){faint} %clr(${LOG_LEVEL_PATTERN:%5p}) %clr([%15.15t]){faint} %clr(%F:%L){cyan} %clr(:){faint} %m %clr({){faint}%X%clr(}){faint}%n${LOG_EXCEPTION_CONVERSION_WORD:%wEx}}
Without any MDC set this adds some weird curly braces at the end of every logged line like here:
<ts> INFO [ <thread>] <java-file>:<lines> : <log message> {}
If you set something in your MDC the curly braces will include the string of the hash (comma separated key=value pairs).