org.apache.logging.log4j.core.appender.rewrite
Class RewriteAppender
java.lang.Object
org.apache.logging.log4j.core.AbstractLifeCycle
org.apache.logging.log4j.core.filter.AbstractFilterable
org.apache.logging.log4j.core.appender.AbstractAppender
org.apache.logging.log4j.core.appender.rewrite.RewriteAppender
- All Implemented Interfaces:
- Serializable, Appender, Filterable, LifeCycle
@Plugin(name="Rewrite",
category="Core",
elementType="appender",
printObject=true)
public final class RewriteAppender
- extends AbstractAppender
This Appender allows the logging event to be manipulated before it is processed by other Appenders.
- See Also:
- Serialized Form
Methods inherited from class org.apache.logging.log4j.core.AbstractLifeCycle |
equalsImpl, getState, hashCodeImpl, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping |
start
public void start()
- Description copied from class:
AbstractFilterable
- Make the Filter available for use.
- Specified by:
start
in interface LifeCycle
- Overrides:
start
in class AbstractFilterable
stop
public void stop()
- Description copied from class:
AbstractFilterable
- Cleanup the Filter.
- Specified by:
stop
in interface LifeCycle
- Overrides:
stop
in class AbstractFilterable
append
public void append(LogEvent event)
- Modify the event and pass to the subordinate Appenders.
- Parameters:
event
- The LogEvent.
createAppender
@PluginFactory
public static RewriteAppender createAppender(@PluginAttribute(value="name")
String name,
@PluginAttribute(value="ignoreExceptions")
String ignore,
@PluginElement(value="AppenderRef")
AppenderRef[] appenderRefs,
@PluginConfiguration
Configuration config,
@PluginElement(value="RewritePolicy")
RewritePolicy rewritePolicy,
@PluginElement(value="Filter")
Filter filter)
- Create a RewriteAppender.
- Parameters:
name
- The name of the Appender.ignore
- If "true"
(default) exceptions encountered when appending events are logged; otherwise
they are propagated to the caller.appenderRefs
- An array of Appender names to call.config
- The Configuration.rewritePolicy
- The policy to use to modify the event.filter
- A Filter to filter events.
- Returns:
- The created RewriteAppender.
Copyright © 1999-2015 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.