ec.addError(new ErrorItem(errMsg));
return;
}
AppenderAttachable appenderAttachable = (AppenderAttachable) o;
String appenderName = attributes.getValue(ActionConst.REF_ATTRIBUTE);
if (Option.isEmpty(appenderName)) {
// print a meaningful error message and return
String errMsg = "Missing appender ref attribute in <appender-ref> tag.";
getLogger().warn(errMsg);
inError = true;
ec.addError(new ErrorItem(errMsg));
return;
}
HashMap appenderBag =
(HashMap) ec.getObjectMap().get(ActionConst.APPENDER_BAG);
Appender appender = (Appender) appenderBag.get(appenderName);
if (appender == null) {
String msg = "Could not find an appender named ["+appenderName+
"]. Did you define it below in the config file?";
getLogger().warn(msg);
getLogger().warn("See {}#appender_order for more details.", Constants.CODES_HREF);
inError = true;
ec.addError(new ErrorItem(msg));
return;
}
if (appenderAttachable instanceof Logger) {
getLogger().debug(
"Attaching appender named [{}] to logger named [{}].", appenderName, (
(Logger) appenderAttachable).getName());
} else {
getLogger().debug(
"Attaching appender named [{}] to {}.", appenderName, appenderAttachable);
}
appenderAttachable.addAppender(appender);
}