Package org.apache.log4j.xml
Class XmlConfiguration
-
- All Implemented Interfaces:
Configuration
,Reconfigurable
,Filterable
,LifeCycle
,LifeCycle2
public class XmlConfiguration extends Log4j1Configuration
Class Description goes here.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.logging.log4j.core.filter.AbstractFilterable
AbstractFilterable.Builder<B extends AbstractFilterable.Builder<B>>
-
Nested classes/interfaces inherited from interface org.apache.logging.log4j.core.LifeCycle
LifeCycle.State
-
-
Field Summary
Fields Modifier and Type Field Description static long
DEFAULT_DELAY
protected static String
DEFAULT_PREFIX
File name prefix for standard configurations.static String
FILTER_TAG
static String
LAYOUT_TAG
static String
NAME_ATTR
static String
PARAM_TAG
static String
REF_ATTR
protected static String
TEST_PREFIX
File name prefix for test configurations.static String
VALUE_ATTR
-
Fields inherited from class org.apache.log4j.config.Log4j1Configuration
APPENDER_REF_TAG, INHERITED, manager, MONITOR_INTERVAL, NULL, THRESHOLD_PARAM
-
Fields inherited from class org.apache.logging.log4j.core.config.AbstractConfiguration
isShutdownHookEnabled, listeners, pluginManager, pluginPackages, rootNode, scriptManager, shutdownTimeoutMillis
-
Fields inherited from class org.apache.logging.log4j.core.AbstractLifeCycle
DEFAULT_STOP_TIMEOUT, DEFAULT_STOP_TIMEUNIT
-
Fields inherited from interface org.apache.logging.log4j.core.config.Configuration
CONTEXT_PROPERTIES
-
-
Constructor Summary
Constructors Constructor Description XmlConfiguration(LoggerContext loggerContext, ConfigurationSource source, int monitorIntervalSeconds)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAppenderIfAbsent(Appender appender)
void
doConfigure()
Configure log4j by reading in a log4j.dtd compliant XML configuration file.Appender
findAppenderByReference(Element appenderRef)
Used internally to parse appenders by IDREF element.static void
forEachElement(NodeList list, Consumer<Element> consumer)
Appender
parseAppender(Element appenderElement)
Used internally to parse an appender element.Object
parseElement(Element element, Properties props, Class expectedClass)
Creates an object and processes any nested param elements but does not call activateOptions.Filter
parseFilters(Element filterElement)
Used internally to parse a filter element.Layout
parseLayout(Element layoutElement)
Used internally to parse a layout element.RewritePolicy
parseRewritePolicy(Element rewritePolicyElement)
void
setParameter(Element elem, PropertySetter propSetter, Properties props)
Sets a parameter based from configuration file content.String
subst(String value, Properties props)
Substitutes property value for any references in expression.-
Methods inherited from class org.apache.log4j.config.Log4j1Configuration
getBuilderManager, initialize, reconfigure
-
Methods inherited from class org.apache.logging.log4j.core.config.AbstractConfiguration
addAppender, addComponent, addListener, addLogger, addLoggerAppender, addLoggerFilter, createAdvertiser, createConfiguration, getAdvertiser, getAppender, getAppenders, getAsyncLoggerConfigDelegate, getComponent, getConfigurationSource, getCustomLevels, getDefaultStatus, getLogger, getLoggerConfig, getLoggerContext, getLoggers, getName, getNanoClock, getPluginManager, getPluginPackages, getProperties, getReliabilityStrategy, getRootLogger, getRootNode, getScheduler, getScriptManager, getShutdownTimeoutMillis, getStrSubstitutor, getWatchManager, initializeWatchers, isShutdownHookEnabled, preConfigure, removeAppender, removeListener, removeLogger, setAdvertiser, setLoggerAdditive, setName, setNanoClock, setPluginManager, setScriptManager, setToDefault, setup, start, stop, toByteArray
-
Methods inherited from class org.apache.logging.log4j.core.filter.AbstractFilterable
addFilter, getFilter, getPropertyArray, hasFilter, isFiltered, removeFilter, stop
-
Methods inherited from class org.apache.logging.log4j.core.AbstractLifeCycle
equalsImpl, getState, getStatusLogger, hashCodeImpl, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping, stop, stop
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.logging.log4j.core.filter.Filterable
addFilter, getFilter, hasFilter, isFiltered, removeFilter
-
-
-
-
Field Detail
-
PARAM_TAG
public static final String PARAM_TAG
- See Also:
- Constant Field Values
-
LAYOUT_TAG
public static final String LAYOUT_TAG
- See Also:
- Constant Field Values
-
NAME_ATTR
public static final String NAME_ATTR
- See Also:
- Constant Field Values
-
VALUE_ATTR
public static final String VALUE_ATTR
- See Also:
- Constant Field Values
-
FILTER_TAG
public static final String FILTER_TAG
- See Also:
- Constant Field Values
-
REF_ATTR
public static final String REF_ATTR
- See Also:
- Constant Field Values
-
DEFAULT_DELAY
public static final long DEFAULT_DELAY
- See Also:
- Constant Field Values
-
TEST_PREFIX
protected static final String TEST_PREFIX
File name prefix for test configurations.- See Also:
- Constant Field Values
-
DEFAULT_PREFIX
protected static final String DEFAULT_PREFIX
File name prefix for standard configurations.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
XmlConfiguration
public XmlConfiguration(LoggerContext loggerContext, ConfigurationSource source, int monitorIntervalSeconds)
-
-
Method Detail
-
addAppenderIfAbsent
public void addAppenderIfAbsent(Appender appender)
-
doConfigure
public void doConfigure() throws FactoryConfigurationError
Configure log4j by reading in a log4j.dtd compliant XML configuration file.- Overrides:
doConfigure
in classAbstractConfiguration
- Throws:
FactoryConfigurationError
-
subst
public String subst(String value, Properties props)
Substitutes property value for any references in expression.- Parameters:
value
- value from configuration file, may contain literal text, property references or bothprops
- properties.- Returns:
- evaluated expression, may still contain expressions if unable to expand.
-
setParameter
public void setParameter(Element elem, PropertySetter propSetter, Properties props)
Sets a parameter based from configuration file content.- Parameters:
elem
- param element, may not be null.propSetter
- property setter, may not be null.props
- properties- Since:
- 1.2.15
-
parseElement
public Object parseElement(Element element, Properties props, Class expectedClass) throws Exception
Creates an object and processes any nested param elements but does not call activateOptions. If the class also supports UnrecognizedElementParser, the parseUnrecognizedElement method will be call for any child elements other than param.- Parameters:
element
- element, may not be null.props
- propertiesexpectedClass
- interface or class expected to be implemented by created class- Returns:
- created class or null.
- Throws:
Exception
- thrown if the contain object should be abandoned.- Since:
- 1.2.15
-
findAppenderByReference
public Appender findAppenderByReference(Element appenderRef)
Used internally to parse appenders by IDREF element.
-
parseAppender
public Appender parseAppender(Element appenderElement)
Used internally to parse an appender element.
-
parseRewritePolicy
public RewritePolicy parseRewritePolicy(Element rewritePolicyElement)
-
parseFilters
public Filter parseFilters(Element filterElement)
Used internally to parse a filter element.
-
parseLayout
public Layout parseLayout(Element layoutElement)
Used internally to parse a layout element.
-
-