Package org.apache.log4j.xml
Class XmlConfiguration
- All Implemented Interfaces:
Configuration
,Reconfigurable
,Filterable
,LifeCycle
,LifeCycle2
Class Description goes here.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
private static interface
private static class
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
FieldsModifier and TypeFieldDescriptionprivate static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
static final long
protected static final String
File name prefix for standard configurations.private static final String
private static final String
static final String
private static final String
static final String
private static final String
private static final Logger
private static final String
private static final String
static final String
private static final String
private static final Class<?>[]
static final String
private static final String
private Properties
static final String
private static final String
private static final String
protected static final String
File name prefix for test configurations.private static final String
private static final String
static final String
Fields inherited from class org.apache.log4j.config.Log4j1Configuration
APPENDER_REF_TAG, DEFAULT_LEVEL, 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
ConstructorsConstructorDescriptionXmlConfiguration
(LoggerContext loggerContext, ConfigurationSource source, int monitorIntervalSeconds) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAppenderIfAbsent
(Appender appender) void
addFilter
(AtomicReference<Filter> ref, Element filterElement) Used internally to parse a filter element.private Appender
buildAppender
(String className, Element appenderElement) private Filter
buildFilter
(String className, Element filterElement) private Layout
buildLayout
(String className, Element layout_element) private RewritePolicy
buildRewritePolicy
(String className, Element element) void
Configures log4j by reading in a log4j.dtd compliant XML configuration file.private void
private Appender
findAppenderByName
(Document doc, String appenderName) Used internally to parse appenders by IDREF name.findAppenderByReference
(Element appenderRef) Used internally to parse appenders by IDREF element.static void
forEachElement
(NodeList list, Consumer<Element> consumer) private void
Used internally to configure the log4j framework by parsing a DOM tree of XML elements based on log4j.dtd.parseAppender
(Element appenderElement) Used internally to parse an appender element.private void
parseCategory
(Element loggerElement) Used internally to parse an category element.private void
parseChildrenOfLoggerElement
(Element catElement, LoggerConfig loggerConfig, boolean isRoot) Used internally to parse the children of a LoggerConfig element.parseElement
(Element element, Properties props, Class expectedClass) Creates an object and processes any nested param elements but does not call activateOptions.private void
parseErrorHandler
(Element element, Appender appender) Used internally to parse anErrorHandler
element.parseFilters
(Element filterElement) Used internally to parse a filter element.parseLayout
(Element layoutElement) Used internally to parse a layout element.private void
parseLevel
(Element element, LoggerConfig logger, boolean isRoot) Used internally to parse a level element.parseRewritePolicy
(Element rewritePolicyElement) private void
Used internally to parse the roor category element.parseTriggeringPolicy
(Element policyElement) private void
parseUnrecognizedElement
(Object instance, Element element, Properties props) Delegates unrecognized content to created instance if it supports UnrecognizedElementParser.private void
quietParseUnrecognizedElement
(Object instance, Element element, Properties props) Delegates unrecognized content to created instance if it supports UnrecognizedElementParser and catches and logs any exception.private void
setParameter
(Element element, PropertySetter propSetter) void
setParameter
(Element elem, PropertySetter propSetter, Properties props) Sets a parameter based from configuration file content.private 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
Methods inherited from class org.apache.logging.log4j.core.config.AbstractConfiguration
addAppender, addComponent, addListener, addLogger, addLoggerAppender, addLoggerFilter, createAdvertiser, createConfiguration, createPluginObject, getAdvertiser, getAppender, getAppenders, getAsyncLoggerConfigDelegate, getAsyncWaitStrategyFactory, getComponent, getConfigurationSource, getConfigurationStrSubstitutor, getCustomLevels, getDefaultLevel, getDefaultStatus, getLogger, getLoggerConfig, getLoggerContext, getLoggers, getName, getNanoClock, getPluginManager, getPluginPackages, getProperties, getReliabilityStrategy, getRootLogger, getRootNode, getScheduler, getScriptManager, getShutdownTimeoutMillis, getStrSubstitutor, getWatchManager, initializeWatchers, isShutdownHookEnabled, preConfigure, processConditionals, processSelect, 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 Details
-
LOGGER
-
CONFIGURATION_TAG
- See Also:
-
OLD_CONFIGURATION_TAG
- See Also:
-
RENDERER_TAG
- See Also:
-
APPENDER_TAG
- See Also:
-
PARAM_TAG
- See Also:
-
LAYOUT_TAG
- See Also:
-
CATEGORY
- See Also:
-
LOGGER_ELEMENT
- See Also:
-
CATEGORY_FACTORY_TAG
- See Also:
-
LOGGER_FACTORY_TAG
- See Also:
-
NAME_ATTR
- See Also:
-
CLASS_ATTR
- See Also:
-
VALUE_ATTR
- See Also:
-
ROOT_TAG
- See Also:
-
LEVEL_TAG
- See Also:
-
PRIORITY_TAG
- See Also:
-
FILTER_TAG
- See Also:
-
ERROR_HANDLER_TAG
- See Also:
-
REF_ATTR
- See Also:
-
ADDITIVITY_ATTR
- See Also:
-
CONFIG_DEBUG_ATTR
- See Also:
-
INTERNAL_DEBUG_ATTR
- See Also:
-
THRESHOLD_ATTR
- See Also:
-
EMPTY_STR
- See Also:
-
ONE_STRING_PARAM
-
dbfKey
- See Also:
-
THROWABLE_RENDERER_TAG
- See Also:
-
DEFAULT_DELAY
public static final long DEFAULT_DELAY- See Also:
-
TEST_PREFIX
File name prefix for test configurations.- See Also:
-
DEFAULT_PREFIX
File name prefix for standard configurations.- See Also:
-
appenderMap
-
props
-
-
Constructor Details
-
XmlConfiguration
public XmlConfiguration(LoggerContext loggerContext, ConfigurationSource source, int monitorIntervalSeconds)
-
-
Method Details
-
addAppenderIfAbsent
-
doConfigure
Configures log4j by reading in a log4j.dtd compliant XML configuration file.- Overrides:
doConfigure
in classAbstractConfiguration
- Throws:
FactoryConfigurationError
-
doConfigure
- Throws:
FactoryConfigurationError
-
reconfigure
- Specified by:
reconfigure
in interfaceReconfigurable
- Overrides:
reconfigure
in classLog4j1Configuration
-
parseUnrecognizedElement
private void parseUnrecognizedElement(Object instance, Element element, Properties props) throws Exception Delegates unrecognized content to created instance if it supports UnrecognizedElementParser.- Parameters:
instance
- instance, may be null.element
- element, may not be null.props
- properties- Throws:
IOException
- thrown if configuration of owner object should be abandoned.Exception
-
quietParseUnrecognizedElement
Delegates unrecognized content to created instance if it supports UnrecognizedElementParser and catches and logs any exception.- Parameters:
instance
- instance, may be null.element
- element, may not be null.props
- properties- Since:
- 1.2.15
-
subst
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
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
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
-
findAppenderByName
Used internally to parse appenders by IDREF name. -
findAppenderByReference
Used internally to parse appenders by IDREF element. -
parseAppender
Used internally to parse an appender element. -
buildAppender
-
parseRewritePolicy
-
buildRewritePolicy
-
parseErrorHandler
Used internally to parse anErrorHandler
element. -
addFilter
Used internally to parse a filter element. -
parseFilters
Used internally to parse a filter element. -
buildFilter
-
parseCategory
Used internally to parse an category element. -
parseRoot
Used internally to parse the roor category element. -
parseChildrenOfLoggerElement
private void parseChildrenOfLoggerElement(Element catElement, LoggerConfig loggerConfig, boolean isRoot) Used internally to parse the children of a LoggerConfig element. -
parseLayout
Used internally to parse a layout element. -
buildLayout
-
parseTriggeringPolicy
-
parseLevel
Used internally to parse a level element. -
setParameter
-
parse
Used internally to configure the log4j framework by parsing a DOM tree of XML elements based on log4j.dtd. -
subst
-
forEachElement
-