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:
Appender
,Filterable
,LocationAware
,LifeCycle
,LifeCycle2
@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.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.logging.log4j.core.appender.AbstractAppender
AbstractAppender.Builder<B extends AbstractAppender.Builder<B>>
Nested classes/interfaces inherited from interface org.apache.logging.log4j.core.LifeCycle
LifeCycle.State
-
Field Summary
Fields inherited from class org.apache.logging.log4j.core.AbstractLifeCycle
DEFAULT_STOP_TIMEOUT, DEFAULT_STOP_TIMEUNIT, LOGGER
Fields inherited from interface org.apache.logging.log4j.core.Appender
ELEMENT_TYPE, EMPTY_ARRAY
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Modifies the event and pass to the subordinate Appenders.static RewriteAppender
createAppender
(String name, String ignore, AppenderRef[] appenderRefs, Configuration config, RewritePolicy rewritePolicy, Filter filter) Creates a RewriteAppender.boolean
void
start()
Make the Filter available for use.Methods inherited from class org.apache.logging.log4j.core.appender.AbstractAppender
error, error, error, getHandler, getLayout, getName, ignoreExceptions, parseInt, setHandler, toSerializable, toString
Methods inherited from class org.apache.logging.log4j.core.filter.AbstractFilterable
addFilter, getFilter, getPropertyArray, hasFilter, isFiltered, removeFilter, stop, stop
Methods inherited from class org.apache.logging.log4j.core.AbstractLifeCycle
equalsImpl, getState, getStatusLogger, hashCodeImpl, initialize, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping, stop, stop
-
Method Details
-
start
public void start()Description copied from class:AbstractFilterable
Make the Filter available for use.- Specified by:
start
in interfaceLifeCycle
- Overrides:
start
in classAbstractFilterable
-
append
Modifies the event and pass to the subordinate Appenders.- Parameters:
event
- The LogEvent.
-
createAppender
@PluginFactory public static RewriteAppender createAppender(@PluginAttribute("name") String name, @PluginAttribute("ignoreExceptions") String ignore, @PluginElement("AppenderRef") AppenderRef[] appenderRefs, @PluginConfiguration Configuration config, @PluginElement("RewritePolicy") RewritePolicy rewritePolicy, @PluginElement("Filter") Filter filter) Creates 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.
-
requiresLocation
public boolean requiresLocation()- Specified by:
requiresLocation
in interfaceLocationAware
- Overrides:
requiresLocation
in classAbstractAppender
-