String className = subst(appenderElement.getAttribute(CLASS_ATTR));
debug("Class name: [" + className + ']');
try
{
Object instance = instantiateByClassName(className, Handler.class, null);
Handler appender = (Handler) instance;
Properties beanProps = new Properties();
String name = subst(appenderElement.getAttribute(NAME_ATTR));
HandlerSkeleton handlerSkeleton = null;
if( appender instanceof HandlerSkeleton )
{
handlerSkeleton = (HandlerSkeleton) appender;
handlerSkeleton.setName(name);
}
NodeList children = appenderElement.getChildNodes();
final int length = children.getLength();
for (int loop = 0; loop < length; loop++)
{
Node currentNode = children.item(loop);
/* We're only interested in Elements */
if (currentNode.getNodeType() == Node.ELEMENT_NODE)
{
Element currentElement = (Element) currentNode;
// Parse appender parameters
if (currentElement.getTagName().equals(PARAM_TAG))
{
setParameter(currentElement, beanProps);
}
// Set appender layout
else if (currentElement.getTagName().equals(LAYOUT_TAG))
{
Formatter format = parseLayout(currentElement);
appender.setFormatter(format);
}
// Add filters
else if (currentElement.getTagName().equals(FILTER_TAG))
{
parseFilters(currentElement, appender);