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 (exte
I'd go for creating a delegate class for Logger
and change all imports from org.apache.log4j.Logger
to your.own.Logger
. It's a simple and automatic process — since you consider changing logger calls in the code, I figure you have full access to source code. In the delegate you'd call exactly the methods from log4j Logger, but meddle with the strings first to your heart's content.
I've browsed through the code and prior to version 1.2.15 creating a new LoggingEvent
from an existing one is impossible without digging through half of the library. From 1.2.15 on there's no problem with it.