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 classprivate static interfaceprivate static classNested 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 Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringprivate static final Stringstatic final longprotected static final StringFile name prefix for standard configurations.private static final Stringprivate static final Stringstatic final Stringprivate static final Stringstatic final Stringprivate static final Stringprivate static final Loggerprivate static final Stringprivate static final Stringstatic final Stringprivate static final Stringprivate static final Class<?>[]static final Stringprivate static final Stringprivate Propertiesstatic final Stringprivate static final Stringprivate static final Stringprotected static final StringFile name prefix for test configurations.private static final Stringprivate static final Stringstatic final StringFields inherited from class org.apache.log4j.config.Log4j1Configuration
APPENDER_REF_TAG, INHERITED, manager, MONITOR_INTERVAL, NULL, THRESHOLD_PARAMFields inherited from class org.apache.logging.log4j.core.config.AbstractConfiguration
isShutdownHookEnabled, listeners, pluginManager, pluginPackages, rootNode, scriptManager, shutdownTimeoutMillisFields inherited from class org.apache.logging.log4j.core.AbstractLifeCycle
DEFAULT_STOP_TIMEOUT, DEFAULT_STOP_TIMEUNITFields 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 TypeMethodDescriptionvoidaddAppenderIfAbsent(Appender appender) voidaddFilter(AtomicReference<Filter> ref, Element filterElement) Used internally to parse a filter element.private AppenderbuildAppender(String className, Element appenderElement) private FilterbuildFilter(String className, Element filterElement) private LayoutbuildLayout(String className, Element layout_element) private RewritePolicybuildRewritePolicy(String className, Element element) voidConfigures log4j by reading in a log4j.dtd compliant XML configuration file.private voidprivate AppenderfindAppenderByName(Document doc, String appenderName) Used internally to parse appenders by IDREF name.findAppenderByReference(Element appenderRef) Used internally to parse appenders by IDREF element.static voidforEachElement(NodeList list, Consumer<Element> consumer) private voidUsed 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 voidparseCategory(Element loggerElement) Used internally to parse an category element.private voidparseChildrenOfLoggerElement(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 voidparseErrorHandler(Element element, Appender appender) Used internally to parse anErrorHandlerelement.parseFilters(Element filterElement) Used internally to parse a filter element.parseLayout(Element layoutElement) Used internally to parse a layout element.private voidparseLevel(Element element, LoggerConfig logger, boolean isRoot) Used internally to parse a level element.parseRewritePolicy(Element rewritePolicyElement) private voidUsed internally to parse the roor category element.private voidparseUnrecognizedElement(Object instance, Element element, Properties props) Delegates unrecognized content to created instance if it supports UnrecognizedElementParser.private voidquietParseUnrecognizedElement(Object instance, Element element, Properties props) Delegates unrecognized content to created instance if it supports UnrecognizedElementParser and catches and logs any exception.private voidsetParameter(Element element, PropertySetter propSetter) voidsetParameter(Element elem, PropertySetter propSetter, Properties props) Sets a parameter based from configuration file content.private Stringsubst(String value, Properties props) Substitutes property value for any references in expression.Methods inherited from class org.apache.log4j.config.Log4j1Configuration
getBuilderManager, initializeMethods inherited from class org.apache.logging.log4j.core.config.AbstractConfiguration
addAppender, addComponent, addListener, addLogger, addLoggerAppender, addLoggerFilter, createAdvertiser, createConfiguration, createPluginObject, getAdvertiser, getAppender, getAppenders, getAsyncLoggerConfigDelegate, 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, toByteArrayMethods inherited from class org.apache.logging.log4j.core.filter.AbstractFilterable
addFilter, getFilter, getPropertyArray, hasFilter, isFiltered, removeFilter, stopMethods inherited from class org.apache.logging.log4j.core.AbstractLifeCycle
equalsImpl, getState, getStatusLogger, hashCodeImpl, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping, stop, stopMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
doConfigurein classAbstractConfiguration- Throws:
FactoryConfigurationError
-
doConfigure
- Throws:
FactoryConfigurationError
-
reconfigure
- Specified by:
reconfigurein interfaceReconfigurable- Overrides:
reconfigurein 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 anErrorHandlerelement. -
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
-
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
-