I am working on a dropwizard project. In the config.yml file i am specifying the log format for the console appender using MDC variables. E.g
appenders:
- type: console
logFormat: "date=%d{yyyy-MM-dd HH:mm:ss} username=%mdc{userName} %t %logger{5} - %X{code} message=%msg %n"
threshold: ${CONSOLE_LOG_LEVEL:-INFO}
However MDC variable returns an empty value in the log. But I can successfully retrieve by MDC.get("userName") somewhere else in the code.