Class PropertiesRewritePolicy
java.lang.Object
org.apache.logging.log4j.core.appender.rewrite.PropertiesRewritePolicy
- All Implemented Interfaces:
RewritePolicy
@Plugin(name="PropertiesRewritePolicy",
category="Core",
elementType="rewritePolicy",
printObject=true)
public final class PropertiesRewritePolicy
extends Object
implements RewritePolicy
This policy modifies events by replacing or possibly adding keys and values to the MapMessage.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Configurationprotected static final LoggerAllows subclasses access to the status logger without creating another instance. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivatePropertiesRewritePolicy(Configuration config, List<Property> props) -
Method Summary
Modifier and TypeMethodDescriptionstatic PropertiesRewritePolicycreatePolicy(Configuration config, Property[] props) Creates a PropertiesRewritePolicy.Rewrites the event.toString()
-
Field Details
-
LOGGER
Allows subclasses access to the status logger without creating another instance. -
properties
-
config
-
-
Constructor Details
-
PropertiesRewritePolicy
-
-
Method Details
-
rewrite
Rewrites the event.- Specified by:
rewritein interfaceRewritePolicy- Parameters:
source- a logging event that may be returned or used to create a new logging event.- Returns:
- The LogEvent after rewriting.
-
toString
-
createPolicy
@PluginFactory public static PropertiesRewritePolicy createPolicy(@PluginConfiguration Configuration config, @PluginElement("Properties") Property[] props) Creates a PropertiesRewritePolicy.- Parameters:
config- The Configuration.props- key/value pairs for the new keys and values.- Returns:
- The PropertiesRewritePolicy.
-