Hi,

Is it possible to specify the key of the MDC through the code i.e. when calling 
one of the printing methods so that only the value corresponding to supplied 
key is logged in the log file. Because in my case I have a map<key, value> and 
at the runtime user decides which corresponding key value needs to be logged 
and hence, I cannot specify key well in advance in configuration file and 
moreover, I dont want to log all from the map.

Thanks & Regards,
Sukesh


> From: [email protected]
> To: [email protected]
> Subject: Re: Need Info/Documentation/Examples for extending log4j for 
> additional fields/info
> Date: Wed, 12 Aug 2009 08:51:00 -0500
> 
> 
> On Aug 12, 2009, at 4:16 AM, sukesh jain wrote:
> 
> >
> > Hi,
> >
> > But MDC requires that you know the key well in advance to be put in  
> > the configuration file which is not possible in my case.
> >
> > Thanks & Regards,
> > Sukesh
> >
> 
> The ExtendedPatternLayout in the extras companion has a specifier  
> (either just a plain %x or %X) to output all the items in the MDC.   
> Then you'd just need to ensure that the keys are unique by some means  
> to avoid overwriting.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 

_________________________________________________________________
One stop at MSN India to catch up with what’s hot in the world around you today
http://in.msn.com

Reply via email to