You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Satyendra Srivastava <sa...@usbank.com> on 2006/07/10 22:20:45 UTC

Re: Filtering out data while logging.

OOMS DIRK <Ext.Dirk.Ooms <at> siemens.be> writes:

> 
> I would put AccountNo, SecretCode, etc in MDC key-value pairs and apply an
> appropriate PatternLayout that leaves out the MDC fields you don't want to
> show.
> 
> dirk
> 
> > -----Original Message-----
> > From: Tasso The Developer [mailto:jappdev <at> hotmail.com] 
> > Sent: woensdag 2 februari 2005 17:03
> > To: log4j-user <at> logging.apache.org
> > Subject: Filtering out data while logging.
> > 
> > 
> > How would I go about masking or removing certain information 
> > so it doesn't 
> > get logged?
> > 
> > For instance...
> > 
> > log.info("Received data from partner: AccountNo=12345, Secret 
> > Code=qwerty; 
> > MessageCode=100");
> > 
> > So in the log it would look like...
> > 
> > Received data from partner: Account=12345, Secret Code=******; 
> > MessageCode=100
> > 
> > _________________________________________________________________
> > Take charge with a pop-up guard built on patented Microsoft(r) 
> > SmartScreen 
> > Technology. 
> > http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&
> > DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines 
> >   Start enjoying all the benefits of MSN(r) Premium right now 
> > and get the 
> > first two months FREE*.
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe <at> logging.apache.org
> > For additional commands, e-mail: log4j-user-help <at> logging.apache.org
> > 
> 


Hi Dirk/All,

I have similar type of requirement. I have some xml string like...
<payload>
<acctNumber>1000101010</acctNumber>
<productCode>123234</productCode>
< ..... > //More fields
...
...
< ..... >
</payload>

I would like to Display this xml as 

<payload>
<acctNumber>******1010</acctNumber>
<productCode>******</productCode>
< ..... > //More fields
...
...
< ..... >
</payload>

I don't have xsd schema for payload. This is dynamic ("Any" type). All I have 
is the field names which need to be masked (e.g. acctNumber,productCode ).
Please help me with some code fragment. I am new to log4j.

Thanks
Satyendra



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org