Customising log4j logging for sensitive data
Posted
by Xetius
on Stack Overflow
See other posts from Stack Overflow
or by Xetius
Published on 2010-05-12T10:36:05Z
Indexed on
2010/05/12
10:54 UTC
Read the original article
Hit count: 243
I have a class which contains sensitive information (Credit card info, phone numbers etc).
I want to be able to pass this class to log4j, but have it obscure certain information.
If I have a class UserInformation which has getPhoneNumber, getCreditCardNumber methods, how would I customise log4j or this class so that it will obscure the numbers correctly.
I want the credit card number to be output as xxxx-xxxx-xxxx-1234 and the phone number to be output as xxxx-xxx-xxx given that these would be 1234-1234-1234-1234 and 1234-567-890
Thanks
© Stack Overflow or respective owner