}
return count;
}
private LogAbstractHandler getHandlerInstance(HandlerElement hndlElem) {
LogAbstractHandler handler = null;
try {
// CREATE HANDLER INSTANCE
if (StringUtils.hasText(hndlElem.getClassName())) {
handler = (LogAbstractHandler) BeanUtils.newInstance(hndlElem.getClassName(), null, null);
handler.setName(hndlElem.getName());
handler.setLevel(hndlElem.getLevel());
// set all custom properties
final Enumeration names = hndlElem.propertyNames();
while (names.hasMoreElements()) {
String name = (String) names.nextElement();
Object value = hndlElem.getProperty(name);
Class type = BeanUtils.getReturnType(handler.getClass(), BeanUtils.buildGET(name));
if (null != type && null != value) {
value = BeanUtils.cast(type, value);
BeanUtils.setValue(handler, name, value);
}
}
// FORMATTER
if (null != handler) {
FormatterElement fmtElem = this.solveFormatterElement(hndlElem.getFormatterElement());
Formatter formatter = this.getFormatterInstance(fmtElem);
if (null != formatter) {
handler.setFormatter(formatter);
}
}
}
} catch (Throwable ignored) {
handler = null;