logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Curt Arnold <carn...@apache.org>
Subject Re: Accessing a LoggingEvent's properties using a PatternLayout
Date Mon, 22 Sep 2008 03:47:21 GMT

On Sep 21, 2008, at 8:11 PM, Adam Woods wrote:

>
> Can anybody help me with this issue?
>
> Is this a feature which was missed or is planned for a later release?
>
> Your help is greatly appreciated.
>
> Cheers,
> Adam Woods
>
> -----Original Message-----
> From: Adam Woods [mailto:adam.woods@rwwa.com.au]
> Sent: Wednesday, 17 September 2008 10:18 AM
> To: log4cxx-user@logging.apache.org
> Subject: Accessing a LoggingEvent's properties using a PatternLayout
>
>
> Hello List,
>
> I am trying to make use of the LoggingEvent's properties map so that  
> my
> logs contain extra data specific to an event. This is implemented in
> log4net, so I didn't think I would run into any problems.
>
> However, on further investigation, the documentation and the code both
> suggest that there is no way to actually access the LoggingEvent's
> properties using the PatternLayout's syntax.
>
> Are the LoggingEvent's properties intended for this kind of use, or  
> am I
> going about this the wrong way?
>
> Cheers,
> Adam Woods
>
>

The nomenclature gets a little muddied.  In log4j 1.2, there were no  
properties just the NDC (nested diagnostic context) and MDC (mapped  
diagnostic context) which were a thread-local stack and map,  
respectively.  In the log4j 1.3 development (since abandoned), the  
term MDC was changed to Properties in some places, but there was not a  
separation between the concepts .  log4cxx inherited from log4j 1.3  
but appears to have separated MDC from Properties, though there is no  
distinct API for injecting or using properties.  It does appear that  
MDC works in the same manner as log4j 1.2, but "properties" appear to  
be a non-functioning stub.

I'm not an log4net expert, but it didn't seem to have a distinct  
properties API vs an MDC API.  It just seems that MDC values are  
stored in a member called Properties.

What were you trying to do and what didn't appear to work in log4cxx  
that did work in log4net?

Mime
View raw message