For security reasons, I need to look at every logged message in my app and possibly modify it before it goes to the log file. I figured I could write a custom appender (extending DailyRollingFileAppender) and override subAppend(LoggingEvent event). Problem is, there's no setter for the message text in LoggingEvent, and the message is a private attribute. I could create a new LoggingEvent with my modified message, but the API doesn't make it easy to copy over the rest of the original LoggingEvent. It all seems designed to discourage meddling with the message in a custom appender.
The only other option I can see is to modify hundreds of logging statements to call a new global method that can modify the text first and then make the Log4J call. I'd rather not!
Has anyone else had the need to modify the logged message in a custom appender?