Anders,

Thanks for pointing out. Yes, that is basically the same idea. I like Ceki's
idea of using InheritableThreadLocal better. However, does anybody have any
example code showing some usage. I tried to read ThreadLocal as well, and
have not completely grasped the concept.

I also like Ceki's idea about using '%x{server}' instead of inventing new
characters for Pattern* classes.

Thanks again.

-----Original Message-----
From: Anders Kristensen [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 12, 2001 3:28 PM
To: LOG4J Users Mailing List
Subject: Re: while we are talking about NDC


This is essentially the same idea that Ceki floated previsouly under the
name "Mapped Diagnostic Context" -- a per-Thread String-to-String map:

  http://marc.theaimsgroup.com/?l=log4j-dev&m=98051571516266&w=2

It's a good idea but hasn't been implemented yet (to my knowledge).

Cheers,
Anders


Seemantini Godbole wrote:
> 
> Hi all,
> 
> For last couple of weeks I have been using log4j and is working very well
> for our logging needs. Ours is a typical J2EE architecture, with JSP,
> servlets,  EJB combination.
> 
> However, we need some client specific info such as the name of the user
who
> logged in, client ip address, request type (login, booking etc)......
> 
> I have been pushing all this info into NDC, which works well also. Now we
> have need to print some and not all info in NDC. Currently with usage of
%x,
> we get it all or none at all.
> 
> I was thinking of writing a NameValueNDC class which will look mostly like
> NDC. Instead of associating a Stack in the static hashtable, it would
> associate another hashtable with every thread in the main hashtable.
> 
> In essence, instead of
> 
> NDC--->Hastable----- Thread1--->Stack1
>                            |---Thread2--->Stack2
> 
> we will have
> 
> NDC--->Hastable----- Thread1--->Hashtable1
>                            |---Thread2--->Hashtable2
> 
> and then, we could have some more characters in Pattern* classes, such as
%o
> for loginName. At the time of printing to the log, %o will prompt the
> Pattern* classes to get LoggingEvent.getNDC.get("loginName"), instead of
> whole NDC and print it to the log. This means somebody will have to do
> NameValueNDC.push("loginName", "log4jUser") prior to actual logging.
> 
> pl. let me know if this is a dumb idea and if there are easier ways of
> achieving this.
> 
> Thanks,
> Seemantini
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

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

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

Reply via email to