public class RedactorAppender
extends org.apache.log4j.rewrite.RewriteAppender
RewriteAppender that redacts the message of
LoggingEvents and delegates to the referenced
Appender.
The redaction rules are enforced by a RedactorPolicy.
The RedactorAppender configuration is as follows:
log4j.appender.redactor=io.confluent.log4j.redactor.RedactorAppender log4j.appender.redactor.appenderRefs=[APPENDERS] log4j.appender.redactor.policy=io.confluent.log4j.redactor.RedactorPolicy log4j.appender.redactor.policy.rules=/full/path/to/rule/file.json log4j.appender.redactor.policy.refreshInterval=60000 log4j.appender.redactor.policy.metrics=com.example.CustomizedMetrics
[APPENDERS] should be the list of appenderRefs, comma separated, to wrap for redaction.
All the appenderRefs listed in [APPENDERS] must match the appenders listed for the logger that you wish to redact.
The redactor appender itself must be added to the logger that
you wish to redact.
The format of the rules file in policy.rules is described in the
StringRedactor class.
| Constructor and Description |
|---|
RedactorAppender() |
| Modifier and Type | Method and Description |
|---|---|
void |
activateOptions()
Called after all options are read in so that they can be acted on
at one time.
|
protected void |
append(org.apache.log4j.spi.LoggingEvent event) |
void |
setAppenderRefs(String refs)
Log4j configurator calls this with the contents found in the config file.
|
void |
setPolicy(RedactorPolicy policy)
Log4j configurator calls this with the contents found in the config file.
|
addAppender, close, getAllAppenders, getAppender, isAttached, parseUnrecognizedElement, removeAllAppenders, removeAppender, removeAppender, requiresLayout, setRewritePolicypublic void setPolicy(RedactorPolicy policy)
policy - The policy that is being set.public void setAppenderRefs(String refs)
refs - The appenderRefs that are being set.public void activateOptions()
activateOptions in interface org.apache.log4j.spi.OptionHandleractivateOptions in class org.apache.log4j.AppenderSkeletonprotected void append(org.apache.log4j.spi.LoggingEvent event)
append in class org.apache.log4j.rewrite.RewriteAppenderCopyright © 2023 Confluent, Inc.. All rights reserved.