in log4j-1.2-api/src/main/java/org/apache/log4j/xml/XmlConfiguration.java [715:786]
private void parse(Element element) {
final String rootElementName = element.getTagName();
if (!rootElementName.equals(CONFIGURATION_TAG)) {
if (rootElementName.equals(OLD_CONFIGURATION_TAG)) {
LOGGER.warn("The <" + OLD_CONFIGURATION_TAG + "> element has been deprecated.");
LOGGER.warn("Use the <" + CONFIGURATION_TAG + "> element instead.");
} else {
LOGGER.error("DOM element is - not a <" + CONFIGURATION_TAG + "> element.");
return;
}
}
final String debugAttrib = subst(element.getAttribute(INTERNAL_DEBUG_ATTR));
LOGGER.debug("debug attribute= \"" + debugAttrib + "\".");
// if the log4j.dtd is not specified in the XML file, then the
// "debug" attribute is returned as the empty string.
String status = "error";
if (!debugAttrib.equals("") && !debugAttrib.equals("null")) {
status = OptionConverter.toBoolean(debugAttrib, true) ? "debug" : "error";
} else {
LOGGER.debug("Ignoring " + INTERNAL_DEBUG_ATTR + " attribute.");
}
final String confDebug = subst(element.getAttribute(CONFIG_DEBUG_ATTR));
if (!confDebug.equals("") && !confDebug.equals("null")) {
LOGGER.warn("The \"" + CONFIG_DEBUG_ATTR + "\" attribute is deprecated.");
LOGGER.warn("Use the \"" + INTERNAL_DEBUG_ATTR + "\" attribute instead.");
status = OptionConverter.toBoolean(confDebug, true) ? "debug" : "error";
}
final StatusConfiguration statusConfig = new StatusConfiguration().withStatus(status);
statusConfig.initialize();
final String threshold = subst(element.getAttribute(THRESHOLD_ATTR));
if (threshold != null) {
final org.apache.logging.log4j.Level level = OptionConverter.convertLevel(threshold.trim(),
org.apache.logging.log4j.Level.ALL);
addFilter(ThresholdFilter.createFilter(level, Result.NEUTRAL, Result.DENY));
}
forEachElement(element.getChildNodes(), currentElement -> {
switch (currentElement.getTagName()) {
case CATEGORY:
case LOGGER_ELEMENT:
parseCategory(currentElement);
break;
case ROOT_TAG:
parseRoot(currentElement);
break;
case RENDERER_TAG:
LOGGER.warn("Log4j 1 renderers are not supported by Log4j 2 and will be ignored.");
break;
case THROWABLE_RENDERER_TAG:
LOGGER.warn("Log4j 1 throwable renderers are not supported by Log4j 2 and will be ignored.");
break;
case CATEGORY_FACTORY_TAG:
case LOGGER_FACTORY_TAG:
LOGGER.warn("Log4j 1 logger factories are not supported by Log4j 2 and will be ignored.");
break;
case APPENDER_TAG:
final Appender appender = parseAppender(currentElement);
appenderMap.put(appender.getName(), appender);
addAppender(AppenderAdapter.adapt(appender));
break;
default:
quietParseUnrecognizedElement(null, currentElement, props);
}
});
}