I am running Wildfly 8.1.0 final in standalone mode and I'm seeing an issue with NDC (nested diagnostics context) not getting propagated for logs that pass through an async handler.
In particular, I'm seeing this on the size-rotating-file-handler. I set a string on NDC in my Java code and it comes out as expected if I assign the log handler directly to my root logger. However, if I put an async handler in between, all logs still come out - but with an empty value for the NDC.
I've included my log handler setup from standalone.xml below:
<!-- Formatter that includes NDC (%x) --> <formatter name="logid-formatter"> <pattern-formatter pattern="%d %-5p [%c] (%t) [file: %F:%L, logid: %x] - %s%E%n" /> </formatter> <!-- Log handler - prints out NDC data when added directly to the root logger, but prints out an empty value for NDC when added to the async handler --> <size-rotating-file-handler name="xyzServer"> <formatter> <named-formatter name="logid-formatter"/> </formatter> <file relative-to="jboss.server.log.dir" path="xyz-server.log"/> <rotate-size value="100m"/> <max-backup-index value="10"/> </size-rotating-file-handler> <!-- Async handler, with the size-rotating-file-handler added as sub-handler --> <async-handler name="ASYNC_xyzServer"> <queue-length value="128"/> <overflow-action value="block"/> <subhandlers> <handler name="xyzServer"/> </subhandlers> </async-handler> <root-logger> <level name="INFO"/> <handlers> <handler name="ASYNC_xyzServer"/> </handlers> </root-logger>
Any help as to why this might be occurring would be greatly appreciated, thanks!
I did more searching on the issue I'm seeing and came across this: [LOGMGR-87] NDC formatting is wrong with AsyncHandler - JBoss Issue Tracker. Seems the issue has been reported back in November 2013, with a priority of "Major", but that work hasn't started on it yet.