If you're able to use log4j 1.3, you could use ReflectionFilter.  

Instead of passing a string in the debug call, pass in a JavaBean (POJO) and 
the ReflectionFilter will build an MDC entry for each JavaBeans-style attribute 
available on the object.

The event's message is provided one of two ways:
- if you have a 'message' attribute (getMessage method), the result of that 
method call is used as the event's message.
- if a 'message' attribute doesn't exist, toString is used as the event's 
message.

Scott


-----Original Message-----
From:   James Stauffer [mailto:[EMAIL PROTECTED]
Sent:   Fri 3/25/2005 6:27 AM
To:     Log4J Users List; Todd Nine
Cc:     
Subject:        Re: Extending Log4j
Using NDC or MDC may work for you.

On Fri, 25 Mar 2005 09:00:13 -0500, Todd Nine <[EMAIL PROTECTED]> wrote:
> Hi all,
>   I have used log4j extensively, but I would like to extend its
> functionality, and I have some questions before I start.  Below is
> what I would like to accomplish
> 
> 1. Enhance Log4j logging by adding web specific information.
> 2. For Instance, log methods should not have the following method parameters
>     .debug(HttpSession, User, Object), or debug(HttpSession, User,
> Object, Throwable),
> 
> 3. Extend the PatternLayout to add the following
> %U = userName
> %u = users id
> %S = users session id string.
> 
> I have been looking at the source and extending Logger does not seem
> the most appropriate, since I do not want users to have access to the
> standard log4j methods.  Does anyone have any ideas?
> 
> Thanks,
> Todd
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

---------------------------------------------------------------------
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