I have configured %X{key} pattern in standalone.xml file(at path /usr/local/wildfly/standalone/configuration) under logging module as given below.
<formatter name="PATTERN">
<pattern-formatter pattern="%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c] (%t) %X{user-identity} %s%E%n"/>
</formatter>
<formatter name="COLOR-PATTERN">
<pattern-formatter pattern="%K{level}%d{HH:mm:ss,SSS} %-5p [%c] (%t) %X{user-identity} %s%E%n"/>
</formatter>
Where user-identity is key which is set in ContainerRequestFilter implementation class like MDC.put("user-identity", "123"). and MDC is Mapped Diagnostic Context in jboss logging.
Same code is working for Development server(i.e. printing user-identity value in server.log file) but not working in QA or Production environment.
Please suggest.
I have solved this problem just by configuring %X{key} pattern in standalone-full.xml file(at path /usr/local/wildfly/standalone/configuration) under logging module configuration under PATTERN and COLOR-PATTERN formatter.