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]

Reply via email to