Package com.ppm.logging.configuration
Class DefaultConfigurationFactory
- java.lang.Object
-
- org.apache.logging.log4j.core.config.builder.api.ConfigurationBuilderFactory
-
- org.apache.logging.log4j.core.config.ConfigurationFactory
-
- com.ppm.logging.configuration.DefaultConfigurationFactory
-
public class DefaultConfigurationFactory extends org.apache.logging.log4j.core.config.ConfigurationFactoryThe PPM Logger Configuration Factory During initialization, Log4j 2 will search for available ConfigurationFactories and then select the one to use. The selected ConfigurationFactory creates the Configuration that Log4j will use. Here is how Log4j finds the available ConfigurationFactories: A system property named "log4j.configurationFactory" can be set with the name of the ConfigurationFactory to be used. ConfigurationFactory.setConfigurationFactory(ConfigurationFactory) can be called with the instance of the ConfigurationFactory to be used. This must be called before any other calls to Log4j. A ConfigurationFactory implementation can be added to the classpath and configured as a plugin in the "ConfigurationFactory" category. The Order annotation can be used to specify the relative priority when multiple applicable ConfigurationFactories are found. ConfigurationFactories have the concept of "supported types", which basically maps to the file extension of the configuration file that the ConfigurationFactory can handle. If a configuration file location is specified, ConfigurationFactories whose supported type does not include "*" or the matching file extension will not be used.- Author:
- pedrotoliveira
- See Also:
- log4j/2.x/manual/customconfig.html
-
-
Field Summary
Fields Modifier and Type Field Description static String[]CONFIG_FILES_TYPESValid file extensions for Configuration files.-
Fields inherited from class org.apache.logging.log4j.core.config.ConfigurationFactory
AUTHORIZATION_PROVIDER, CATEGORY, CONFIGURATION_FACTORY_PROPERTY, CONFIGURATION_FILE_PROPERTY, DEFAULT_PREFIX, LOG4J1_CONFIGURATION_FILE_PROPERTY, LOG4J1_EXPERIMENTAL, LOG4J1_VERSION, LOG4J2_VERSION, LOGGER, substitutor, TEST_PREFIX
-
-
Constructor Summary
Constructors Constructor Description DefaultConfigurationFactory()DefaultConfigurationFactory(PropertiesLoader propertiesLoader)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.logging.log4j.core.config.ConfigurationgetConfiguration(org.apache.logging.log4j.core.LoggerContext loggerContext, String name, URI configLocation)org.apache.logging.log4j.core.config.ConfigurationgetConfiguration(org.apache.logging.log4j.core.LoggerContext loggerContext, org.apache.logging.log4j.core.config.ConfigurationSource source)PropertiesLoadergetPropertiesLoader()protected String[]getSupportedTypes()-
Methods inherited from class org.apache.logging.log4j.core.config.ConfigurationFactory
authorizationProvider, getAuthorizationProvider, getConfiguration, getDefaultPrefix, getInputFromString, getInstance, getTestPrefix, getVersion, isActive, removeConfigurationFactory, resetConfigurationFactory, setConfigurationFactory
-
-
-
-
Field Detail
-
CONFIG_FILES_TYPES
public static final String[] CONFIG_FILES_TYPES
Valid file extensions for Configuration files. Because it specifies a supported type of "*" it will override any configuration files provided
-
-
Constructor Detail
-
DefaultConfigurationFactory
public DefaultConfigurationFactory()
-
DefaultConfigurationFactory
public DefaultConfigurationFactory(PropertiesLoader propertiesLoader)
-
-
Method Detail
-
getSupportedTypes
protected String[] getSupportedTypes()
- Specified by:
getSupportedTypesin classorg.apache.logging.log4j.core.config.ConfigurationFactory
-
getConfiguration
public org.apache.logging.log4j.core.config.Configuration getConfiguration(org.apache.logging.log4j.core.LoggerContext loggerContext, org.apache.logging.log4j.core.config.ConfigurationSource source)- Specified by:
getConfigurationin classorg.apache.logging.log4j.core.config.ConfigurationFactory
-
getConfiguration
public org.apache.logging.log4j.core.config.Configuration getConfiguration(org.apache.logging.log4j.core.LoggerContext loggerContext, String name, URI configLocation)- Overrides:
getConfigurationin classorg.apache.logging.log4j.core.config.ConfigurationFactory
-
getPropertiesLoader
public PropertiesLoader getPropertiesLoader()
-
-