public interface Configuration extends Filterable
Custom implementations are recommended to extend AbstractConfiguration
.
AbstractConfiguration
,
LifeCycle2
LifeCycle.State
Modifier and Type | Field and Description |
---|---|
static String |
CONTEXT_PROPERTIES
Key for storing the Context properties.
|
Modifier and Type | Method and Description |
---|---|
void |
addAppender(Appender appender) |
void |
addComponent(String name,
Object object) |
void |
addListener(ConfigurationListener listener) |
void |
addLogger(String name,
LoggerConfig loggerConfig) |
void |
addLoggerAppender(Logger logger,
Appender appender) |
void |
addLoggerFilter(Logger logger,
Filter filter) |
void |
createConfiguration(Node node,
LogEvent event) |
Advertiser |
getAdvertiser() |
<T extends Appender> |
getAppender(String name)
Returns the Appender with the specified name.
|
Map<String,Appender> |
getAppenders()
Returns a Map containing all the Appenders and their name.
|
AsyncLoggerConfigDelegate |
getAsyncLoggerConfigDelegate()
Returns the
AsyncLoggerConfigDelegate shared by all
AsyncLoggerConfig instances defined in this Configuration. |
<T> T |
getComponent(String name) |
ConfigurationSource |
getConfigurationSource()
Returns the source of this configuration.
|
List<CustomLevelConfig> |
getCustomLevels()
Returns a list of descriptors of the custom levels defined in the current configuration.
|
LoggerConfig |
getLoggerConfig(String name)
Locates the appropriate LoggerConfig for a Logger name.
|
LoggerContext |
getLoggerContext()
Gets the logger context.
|
Map<String,LoggerConfig> |
getLoggers() |
String |
getName()
Returns the configuration name.
|
NanoClock |
getNanoClock()
Returns the
NanoClock instance for this configuration. |
List<String> |
getPluginPackages()
Returns the list of packages to scan for plugins for this Configuration.
|
Map<String,String> |
getProperties() |
ReliabilityStrategy |
getReliabilityStrategy(LoggerConfig loggerConfig) |
LoggerConfig |
getRootLogger()
Returns the root Logger.
|
ConfigurationScheduler |
getScheduler() |
ScriptManager |
getScriptManager() |
long |
getShutdownTimeoutMillis() |
StrSubstitutor |
getStrSubstitutor() |
WatchManager |
getWatchManager()
Return the WatchManager.
|
boolean |
isShutdownHookEnabled() |
void |
removeListener(ConfigurationListener listener) |
void |
removeLogger(String name) |
void |
setAdvertiser(Advertiser advertiser) |
void |
setLoggerAdditive(Logger logger,
boolean additive) |
void |
setNanoClock(NanoClock nanoClock)
Sets the
NanoClock instance for this configuration. |
addFilter, getFilter, hasFilter, isFiltered, removeFilter
static final String CONTEXT_PROPERTIES
String getName()
LoggerConfig getLoggerConfig(String name)
name
- The Logger name.<T extends Appender> T getAppender(String name)
T
- The expected Appender type.name
- The name of the Appender.Map<String,Appender> getAppenders()
void addAppender(Appender appender)
Map<String,LoggerConfig> getLoggers()
void setLoggerAdditive(Logger logger, boolean additive)
void addLogger(String name, LoggerConfig loggerConfig)
void removeLogger(String name)
List<String> getPluginPackages()
LoggerConfig getRootLogger()
void addListener(ConfigurationListener listener)
void removeListener(ConfigurationListener listener)
StrSubstitutor getStrSubstitutor()
<T> T getComponent(String name)
void setAdvertiser(Advertiser advertiser)
Advertiser getAdvertiser()
boolean isShutdownHookEnabled()
long getShutdownTimeoutMillis()
ConfigurationScheduler getScheduler()
ConfigurationSource getConfigurationSource()
List<CustomLevelConfig> getCustomLevels()
Returns a list of descriptors of the custom levels defined in the current configuration. The returned list does
not include custom levels that are defined in code with direct calls to Level.forName(String, int)
.
Note that the list does not include levels of previous configurations. For example, suppose a configuration
contains custom levels A, B and C. The configuration is then modified to contain custom levels B, C and D. For
the new configuration, this method will return only {B, C, D}, that is, only the custom levels defined in
this configuration. The previously defined level A still exists (and can be obtained with
Level.getLevel(String)
), it is just not in the current configuration. Level.values()
will return
{A, B, C, D and the built-in levels}.
ScriptManager getScriptManager()
AsyncLoggerConfigDelegate getAsyncLoggerConfigDelegate()
AsyncLoggerConfigDelegate
shared by all
AsyncLoggerConfig
instances defined in this Configuration.AsyncLoggerConfigDelegate
WatchManager getWatchManager()
ReliabilityStrategy getReliabilityStrategy(LoggerConfig loggerConfig)
NanoClock getNanoClock()
NanoClock
instance for this configuration.void setNanoClock(NanoClock nanoClock)
NanoClock
instance for this configuration.nanoClock
- the new nano clock for this configuration. Must be non-null.LoggerContext getLoggerContext()
Copyright © 1999-2018 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.