Class DefaultMergeStrategy
java.lang.Object
org.apache.logging.log4j.core.config.composite.DefaultMergeStrategy
- All Implemented Interfaces:
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.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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.
-
Constructor Details
-
DefaultMergeStrategy
public DefaultMergeStrategy()
-
-
Method Details
-
mergeRootProperties
Merge the root properties.- Specified by:
mergeRootProperties
in interfaceMergeStrategy
- Parameters:
rootNode
- The composite root node.configuration
- The configuration to merge.
-
mergConfigurations
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.
-