You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by "Zimney, Christopher M." <ch...@wamu.net> on 2006/04/21 20:43:07 UTC
No enumerable context anymore?
Sorry if this has been covered a million times.
I used to iterate through the MDC of a given LoggingEvent when
rendering. Something like this:
// Append the MDC values if any exist
if(loggingEvent.MappedContext != null &&
loggingEvent.MappedContext.Count > 0)
{
foreach(DictionaryEntry entry in loggingEvent.MappedContext)
{
xTxtWriter.WriteStartElement(entry.Key.ToString());
xTxtWriter.WriteString(entry.Value.ToString());
xTxtWriter.WriteEndElement();
}
}
The result would be something like:
<Property1>Value</Property1>
<Property2>Value</Property2>
How can I accomplish this with the new ThreadContextProperties?
Thanks!