I'm looking to build a string using values set in an object. The string will be the xml representation of the object. Once I have built the string, I would like to write it to the log file and with certain values (like passwords) masked out with "*". The question I have is how do I do this in a way that is reasonable performance conscious? I see two main options:
1. Build two strings from the object (one for logging and one for the application) so that the loggable string can simply be written to the log.
2. Build the string to be used by the application and then search for the fields that I want to mask and build the loggable string.
1. Build two strings from the object (one for logging and one for the application) so that the loggable string can simply be written to the log.
2. Build the string to be used by the application and then search for the fields that I want to mask and build the loggable string.