logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jacob L. Anawalt" <janaw...@geckosoftware.com>
Subject Re: Addning new fields to the logs.
Date Tue, 17 Mar 2009 16:40:03 GMT
On 2009-03-16 20:27, Dale King wrote:
> On Sun, Mar 15, 2009 at 4:00 PM, Rodolfo Gonzalez <rgonzalez72@yahoo.com>wrote:
>> we had this new requirement to add some new unsupported fields in the log.
>>
>> I don't know if this is the best way to do it works for us. Any alternative
>> approach will be highly appreciated.
 >
> I think you want a Mapped Diagnostic Context (MDC) which lets you add
> name-value pairs in thread specific storage that you can access in the log.
> 

That was my first thought too, but I was thinking of mostly static per-thread 
data or even per-app data that I just init before creating child threads. I 
wondered though, what about dynamic data like the time data from %r and %d. Sure 
I don't need %r and %d and could do the same by hand each call in my %m data, 
but I'm glad I don't have to. Knowing what the new unsupported fields were would 
help me decide if MDC would have been acceptable.

I got a copy of Rodolfo's code to get a better idea of what he is talking about. 
  I don't have my head around all of it, but it looks clean and flexible. I 
still feel like I haven't caught the full vision yet. I am left wondering why 
w1-w3 formats have been reserved. Was it just to provide a testing facility as 
proof of concept? I also found myself wishing for a sample implementation that 
extends a the code with some dynamic runtime data not available in the 
PatternLayout and not appropriate for an MDC.

-- 
Jacob Anawalt
Gecko Software, Inc.
janawalt@geckosoftware.com
435-752-8026

Mime
View raw message