Inspired by some of the stuff Scott Deboy has been doing with his new
Chainsaw interface, I started looking to add the MDC to the DefaultViewer
(just applying some of the "apache way" and digging in to do it myself!).  I
want to add a column that displays all the MDC key/value pairs in the
LoggingEvent.  A similar functionality can be added for the recently added
properties.  But, there are no methods on LoggingEvent to get access to all
the MDC key/value pairs.  The MDC has the getContext() method, but the
javadoc suggests that it should not be generally used, and in any event,
LoggingEvent does not provide direct access to the MDC object it references.

1) We could provide a method on the LoggingEvent to return an iterator for
either the MDC copy or the current MDC.  A little concerned about an
iterator over the current MDC as its keys/values can be changed.  Iterating
over the MDC copy should be fine as we don't expect it to change.

2) The MDC copy is not acquired until the LoggingEvent is serialized.  Isn't
that potentially a problem?  It might be that the MDC context is changed in
some manner after the LoggingEvent is created but before it is serialized.
I imagine it is this way so that the cost of cloning the Hashtable is not
incurred when the LoggingEvent is not serialized (just appended normally),
but it is a potential problem, right?

I'm thinking these 2 issues are somewhat related.

-Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to