this.initializeFromDocument(document, false);
}
private void initializeFromDocument(XmlDocument document,
boolean isFromWatchDog) throws LogConfigurationException {
XmlNode root = document.getDocumentElement();
if (null == root) {
throw new LogConfigurationException("Invalid configuration file! Root node should not be NULL.");
}
// common properties
this.setCommonProperties(root);
// check if is enabled or not
if (!_enabled) {
_logger.info(String.format("%s is not enabled. Logging is managed from container.", this.getClass().getSimpleName()));
return;
} else {
_logger.info(String.format("%s is enabled and will manage application logging.", this.getClass().getSimpleName()));
}
// global formatters
this.clearFormatterElementCache();
XmlNode formattersNode = root.getChild(ConfigurationTags.formatters.toString());
if (null != formattersNode) {
this.initFormattersCache(formattersNode.getChilds(ConfigurationTags.formatter.toString()));
}
// global handlers
this.clearHandlerElementCache();
XmlNode handlersNode = root.getChild(ConfigurationTags.handlers.toString());
if (null != handlersNode) {
this.initHandlersCache(handlersNode.getChilds(ConfigurationTags.handler.toString()));
}
// initialized loggers
this.clearLoggerElementCache();
XmlNode loggersNode = root.getChild(ConfigurationTags.loggers.toString());
if (null != loggersNode) {
this.initLoggersCache(loggersNode.getChilds(ConfigurationTags.logger.toString()));
}
// if watchdog is enabled, configure loggers using watchdog
if (_enableWatchDog) {
// init WATCH DOG
this.initWatchDog(_enableWatchDog);