Reputation: 125
I'm trying to MODIFY, not DENY, certain messages before being logged using Log4J 2. I'm currently trying to use a Filter
, but I can't seem to be able to modify a message from any of it's methods.
Please be patient with me as I'm totally new to Log4j.
Upvotes: 1
Views: 1273
Reputation: 9151
Log4j purposely does not let you modify the LogEvent as it might get passed on to other Filters and Appenders that expected the original event. However, the RewriteAppender will let you create a copy of the LogEvent that is modified and then pass that to a subordinate Appender. The RoutingAppender also supports a RewritePolicy that does the same thing.
Upvotes: 3