The layered properties model in 1.2.9 has replaced the MDC model. The
MDC is emulated using ThreadContextProperties.

To get the properties map from the LoggingEvent use the
LoggingEvent.GetProperties() method. You should be able to iterate
through this in exactly the same way as before.

Cheers,
Nicko

> -----Original Message-----
> From: Zimney, Christopher M. [mailto:[EMAIL PROTECTED] 
> Sent: 24 August 2005 22:18
> To: [email protected]
> Subject: Enumerating Context properties.
> 
> 
> Friends, 
> 
> When using 1.2.8, 
> 
> I created a custom Layout that enumerated the entries of the 
> MappedContext exposed by a LoggingEvent: 
> 
> // Append the MDC values if any exist
> if(loggingEvent.MappedContext != null && 
> loggingEvent.MappedContext.Count > 0) { 
>     foreach(DictionaryEntry entry in loggingEvent.MappedContext) 
>     { 
>         // xTxtWriter instantiated earlier as an XmlTestWriter 
>         xTxtWriter.WriteStartElement(entry.Key.ToString()); 
>         xTxtWriter.WriteString(entry.Value.ToString()); 
>         xTxtWriter.WriteEndElement(); 
>     }
> }
> 
> The result is something like this: 
> 
> <Context> 
>     <Entry1>Value1</Entry1> 
>     <Entry2>Value2</Entry2>
> </Context>
> 
> 
> In 1.2.9, the mapping is no longer exposed and I'm unsure how 
> to enumerate the entries of any of the new Context objects 
> (LogicalThreadContext, etc.)
> 
> Any ideas? 
> 
> 
> _____________ 
> Chris Zimney 
> WaMu Online 
> 206-461-4713 
> 
> 

Reply via email to