public abstract class ConfigurationFactory extends ConfigurationBuilderFactory
Configuration
objects from a configuration file.
ConfigurationFactory allows the configuration implementation to be
dynamically chosen in 1 of 3 ways:
ConfigurationFactory
category. The Order
annotation should be used to configure the
factory to be the first one inspected. See
XmlConfigurationFactory for an example.Modifier and Type | Field and Description |
---|---|
static String |
AUTHORIZATION_PROVIDER |
static String |
CATEGORY
Plugin category used to inject a ConfigurationFactory
Plugin
class. |
static String |
CONFIGURATION_FACTORY_PROPERTY
Allows the ConfigurationFactory class to be specified as a system property.
|
static String |
CONFIGURATION_FILE_PROPERTY
Allows the location of the configuration file to be specified as a system property.
|
protected static String |
DEFAULT_PREFIX
File name prefix for standard configurations.
|
static String |
LOG4J1_CONFIGURATION_FILE_PROPERTY |
static String |
LOG4J1_EXPERIMENTAL |
protected static String |
LOG4J1_VERSION |
protected static String |
LOG4J2_VERSION |
protected static org.apache.logging.log4j.Logger |
LOGGER
Allows subclasses access to the status logger without creating another instance.
|
protected StrSubstitutor |
substitutor |
protected static String |
TEST_PREFIX
File name prefix for test configurations.
|
Constructor and Description |
---|
ConfigurationFactory() |
Modifier and Type | Method and Description |
---|---|
static AuthorizationProvider |
authorizationProvider(org.apache.logging.log4j.util.PropertiesUtil props) |
static AuthorizationProvider |
getAuthorizationProvider() |
abstract Configuration |
getConfiguration(LoggerContext loggerContext,
ConfigurationSource source) |
Configuration |
getConfiguration(LoggerContext loggerContext,
String name,
URI configLocation)
Returns the Configuration.
|
Configuration |
getConfiguration(LoggerContext loggerContext,
String name,
URI configLocation,
ClassLoader loader)
Returns the Configuration obtained using a given ClassLoader.
|
protected String |
getDefaultPrefix() |
protected ConfigurationSource |
getInputFromString(String config,
ClassLoader loader)
Loads the configuration from the location represented by the String.
|
static ConfigurationFactory |
getInstance()
Returns the ConfigurationFactory.
|
protected abstract String[] |
getSupportedTypes() |
protected String |
getTestPrefix() |
protected String |
getVersion() |
protected boolean |
isActive() |
static void |
removeConfigurationFactory(ConfigurationFactory factory)
Removes the ConfigurationFactory.
|
static void |
resetConfigurationFactory()
Resets the ConfigurationFactory to the default.
|
static void |
setConfigurationFactory(ConfigurationFactory factory)
Sets the configuration factory.
|
newConfigurationBuilder, newConfigurationBuilder
public static final String CONFIGURATION_FACTORY_PROPERTY
public static final String CONFIGURATION_FILE_PROPERTY
public static final String LOG4J1_CONFIGURATION_FILE_PROPERTY
public static final String LOG4J1_EXPERIMENTAL
public static final String AUTHORIZATION_PROVIDER
public static final String CATEGORY
Plugin
class.protected static final org.apache.logging.log4j.Logger LOGGER
protected static final String TEST_PREFIX
protected static final String DEFAULT_PREFIX
protected static final String LOG4J1_VERSION
protected static final String LOG4J2_VERSION
protected final StrSubstitutor substitutor
public ConfigurationFactory()
public static ConfigurationFactory getInstance()
public static AuthorizationProvider authorizationProvider(org.apache.logging.log4j.util.PropertiesUtil props)
public static AuthorizationProvider getAuthorizationProvider()
public static void setConfigurationFactory(ConfigurationFactory factory)
factory
- the ConfigurationFactory.public static void resetConfigurationFactory()
public static void removeConfigurationFactory(ConfigurationFactory factory)
factory
- The factory to remove.protected abstract String[] getSupportedTypes()
protected String getTestPrefix()
protected String getDefaultPrefix()
protected String getVersion()
protected boolean isActive()
public abstract Configuration getConfiguration(LoggerContext loggerContext, ConfigurationSource source)
public Configuration getConfiguration(LoggerContext loggerContext, String name, URI configLocation)
loggerContext
- The logger contextname
- The configuration name.configLocation
- The configuration location.public Configuration getConfiguration(LoggerContext loggerContext, String name, URI configLocation, ClassLoader loader)
loggerContext
- The logger contextname
- The configuration name.configLocation
- A URI representing the location of the configuration.loader
- The default ClassLoader to use. If this is null
, then the
default ClassLoader will be used.protected ConfigurationSource getInputFromString(String config, ClassLoader loader)
config
- The configuration location.loader
- The default ClassLoader to use.Copyright © 1999-2020 The 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.