Class DefaultMergeStrategy
- java.lang.Object
-
- org.apache.logging.log4j.core.config.composite.DefaultMergeStrategy
-
- All Implemented Interfaces:
MergeStrategy
public class DefaultMergeStrategy extends java.lang.Object implements MergeStrategy
The default merge strategy for composite configurations.The default merge strategy performs the merge according to the following rules:
- Aggregates the global configuration attributes with those in later configurations replacing those in previous configurations with the exception that the highest status level and the lowest monitorInterval greater than 0 will be used.
- Properties from all configurations are aggregated. Duplicate properties replace those in previous configurations.
- Filters are aggregated under a CompositeFilter if more than one Filter is defined. Since Filters are not named duplicates may be present.
- Scripts and ScriptFile references are aggregated. Duplicate definitions replace those in previous configurations.
- Appenders are aggregated. Appenders with the same name are replaced by those in later configurations, including all of the Appender's subcomponents.
- Loggers are all aggregated. Logger attributes are individually merged with duplicates being replaced by those in later configurations. Appender references on a Logger are aggregated with duplicates being replaced by those in later configurations. Filters on a Logger are aggregated under a CompositeFilter if more than one Filter is defined. Since Filters are not named duplicates may be present. Filters under Appender references included or discarded depending on whether their parent Appender reference is kept or discarded.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
APPENDERS
private static java.lang.String
FILTERS
private static java.lang.String
LOGGERS
private static java.lang.String
NAME
private static java.lang.String
PROPERTIES
private static java.lang.String
REF
private static java.lang.String
SCRIPTS
private static java.lang.String
STATUS
-
Constructor Summary
Constructors Constructor Description DefaultMergeStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private Node
getLoggerNode(Node parentNode, java.lang.String name)
private boolean
isFilterNode(Node node)
private boolean
isSameName(Node node1, Node node2)
private boolean
isSameReference(Node node1, Node node2)
void
mergConfigurations(Node target, Node source, PluginManager pluginManager)
Merge the source Configuration into the target Configuration.void
mergeRootProperties(Node rootNode, AbstractConfiguration configuration)
Merge the root properties.private void
updateFilterNode(Node target, Node targetChildNode, Node sourceChildNode, PluginManager pluginManager)
-
-
-
Field Detail
-
APPENDERS
private static final java.lang.String APPENDERS
- See Also:
- Constant Field Values
-
PROPERTIES
private static final java.lang.String PROPERTIES
- See Also:
- Constant Field Values
-
LOGGERS
private static final java.lang.String LOGGERS
- See Also:
- Constant Field Values
-
SCRIPTS
private static final java.lang.String SCRIPTS
- See Also:
- Constant Field Values
-
FILTERS
private static final java.lang.String FILTERS
- See Also:
- Constant Field Values
-
STATUS
private static final java.lang.String STATUS
- See Also:
- Constant Field Values
-
NAME
private static final java.lang.String NAME
- See Also:
- Constant Field Values
-
REF
private static final java.lang.String REF
- See Also:
- Constant Field Values
-
-
Method Detail
-
mergeRootProperties
public void mergeRootProperties(Node rootNode, AbstractConfiguration configuration)
Merge the root properties.- Specified by:
mergeRootProperties
in interfaceMergeStrategy
- Parameters:
rootNode
- The composite root node.configuration
- The configuration to merge.
-
mergConfigurations
public void mergConfigurations(Node target, Node source, PluginManager pluginManager)
Merge the source Configuration into the target Configuration.- Specified by:
mergConfigurations
in interfaceMergeStrategy
- Parameters:
target
- The target node to merge into.source
- The source node.pluginManager
- The PluginManager.
-
updateFilterNode
private void updateFilterNode(Node target, Node targetChildNode, Node sourceChildNode, PluginManager pluginManager)
-
isFilterNode
private boolean isFilterNode(Node node)
-
-