You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by "Kostello, Don" <do...@citigroup.com> on 2005/06/24 23:57:17 UTC

LoggingEvent class / Asynchronous logging

We are looking to extend the JMSAppender to send all the MDC name / value pairs.  This will allow us to have the user set log message parameters at the start of a session, and all subsequent events will have that information.  The problem is that this data is not readily available in the LoggingEvent if we log asynchronously.

There is a getMDC(String key) method, but that assumes that we know all the available keys, which we won't.  The mdcCopy element in LoggingEvent is private, so we don't have access to it.  We are doing a workaround to create an appender that will run before the async appender and place the MDC context into a known key, but that solution is less than ideal.  I believe that a getMDCContext() method to return either the mdcCopy context if available, or the local MDC context would be preferable.  How is it possible to get this done?

As a side note, the getMDCCopy() in LoggingEvent doesn't seem correct, since it doesn't return anything.  I would think a name like doMDCCopy() would be better.

Don Kostello

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org