I have a security tool that sends users their new password through email. The production email module (that I don’t own and don’t want to change) will log the entire html email message body using Log4Net when the threshold is VERBOSE. Since the email contains a domain user’s password in clear text, I would like to remove the password from the log messages before it reaches the appenders.
Is there a way for me to temporary insert an object into the Log4Net stack that would allow me to search the LoggingEvent message and alter it to mask out any passwords that I find? I’d like to insert the object, call the email module, and then remove the object.
A small improvement to Chris Priest's solution: inherit your appender not from ForwardingAppender, but from base class AppenderSkeleton. It makes configuration a bit simpler - you don't need to reference other appenders from your one and apply it easily to different loggers now
usage