logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sukesh jain <jainsuk...@hotmail.com>
Subject RE: Need Info/Documentation/Examples for extending log4j for additional fields/info
Date Thu, 13 Aug 2009 16:58:23 GMT

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: carnold@apache.org
> To: log4j-user@logging.apache.org
> 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: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 

_________________________________________________________________
One stop at MSN India to catch up with what’s hot in the world around you today
http://in.msn.com
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message