private void setupAppenderIfRequired(LogEvent event) { if (appenderControl.get() == null) { if (node.getType().getElementName().equalsIgnoreCase("appender")) { for (final Node cnode : node.getChildren()) { final Node appNode = new Node(cnode);
private boolean isFilterNode(final Node node) { return Filter.class.isAssignableFrom(node.getType().getPluginClass()); }
private void printNodes(final String indent, final Node node, final StringBuilder sb) { sb.append(indent).append(node.getName()).append(" type: ").append(node.getType()).append("\n"); sb.append(indent).append(node.getAttributes().toString()).append("\n"); for (final Node child : node.getChildren()) { printNodes(indent + " ", child, sb); } } }
private Node findNamedNode(final String name, final Iterable<Node> children) { for (final Node child : children) { final PluginType<?> childType = child.getType(); if (childType == null) { //System.out.println(); } if (name.equalsIgnoreCase(childType.getElementName()) || this.conversionType.isAssignableFrom(childType.getPluginClass())) { // FIXME: check child.getObject() for null? // doing so would be more consistent with the array version return child; } } return null; } }
protected void preConfigure(final Node node) { try { for (final Node child : node.getChildren()) { if (child.getType() == null) { LOGGER.error("Unable to locate plugin type for " + child.getName()); continue; } final Class<?> clazz = child.getType().getPluginClass(); if (clazz.isAnnotationPresent(Scheduled.class)) { configurationScheduler.incrementScheduledItems(); } preConfigure(child); } } catch (final Exception ex) { LOGGER.error("Error capturing node data for node " + node.getName(), ex); } }
private void verifyNodeChildrenUsed() { final List<Node> children = node.getChildren(); if (!(pluginType.isDeferChildren() || children.isEmpty())) { for (final Node child : children) { final String nodeType = node.getType().getElementName(); final String start = nodeType.equals(node.getName()) ? node.getName() : nodeType + ' ' + node.getName(); LOGGER.error("{} has no parameter that matches element {}", start, child.getName()); } } } }
boolean first = true; for (final Node child : node.getChildren()) { final PluginType<?> childType = child.getType(); if (name.equalsIgnoreCase(childType.getElementName()) || this.conversionType.isAssignableFrom(childType.getPluginClass())) {
private void updateFilterNode(final Node target, final Node targetChildNode, final Node sourceChildNode, final PluginManager pluginManager) { if (CompositeFilter.class.isAssignableFrom(targetChildNode.getType().getPluginClass())) { final Node node = new Node(targetChildNode, sourceChildNode.getName(), sourceChildNode.getType()); node.getChildren().addAll(sourceChildNode.getChildren()); node.getAttributes().putAll(sourceChildNode.getAttributes()); targetChildNode.getChildren().add(node); } else { final PluginType pluginType = pluginManager.getPluginType(FILTERS); final Node filtersNode = new Node(targetChildNode, FILTERS, pluginType); final Node node = new Node(filtersNode, sourceChildNode.getName(), sourceChildNode.getType()); node.getAttributes().putAll(sourceChildNode.getAttributes()); final List<Node> children = filtersNode.getChildren(); children.add(targetChildNode); children.add(node); final List<Node> nodes = target.getChildren(); nodes.remove(targetChildNode); nodes.add(filtersNode); } }
private void setupAppenderIfRequired(LogEvent event) { if (appenderControl.get() == null) { if (node.getType().getElementName().equalsIgnoreCase("appender")) { for (final Node cnode : node.getChildren()) { final Node appNode = new Node(cnode);
public Appender createAppender(final String appenderName, final String actualName) { final Node node = nodeMap.get(appenderName); if (node == null) { LOGGER.error("No node named {} in {}", appenderName, this); return null; } node.getAttributes().put("name", actualName); if (node.getType().getElementName().equals(Appender.ELEMENT_TYPE)) { final Node appNode = new Node(node); configuration.createConfiguration(appNode, null); if (appNode.getObject() instanceof Appender) { final Appender app = appNode.getObject(); app.start(); return app; } LOGGER.error("Unable to create Appender of type " + node.getName()); return null; } LOGGER.error("No Appender was configured for name {} " + appenderName); return null; } }
@Override public void createConfiguration(final Node node, final LogEvent event) { final PluginType<?> type = node.getType(); if (type != null && type.isDeferChildren()) { node.setObject(createPluginObject(type, node, event)); } else { for (final Node child : node.getChildren()) { createConfiguration(child, event); } if (type == null) { if (node.getParent() != null) { LOGGER.error("Unable to locate plugin for {}", node.getName()); } } else { node.setObject(createPluginObject(type, node, event)); } } }
final Node loggerNode = new Node(targetChildNode, node.getName(), node.getType()); if (targetNode != null) { targetNode.getAttributes().putAll(node.getAttributes()); sourceLoggerChild.getType()); targetNode.getChildren().add(childNode); sourceLoggerChild.getType()); childNode.getAttributes().putAll(sourceLoggerChild.getAttributes()); childNode.getChildren().addAll(sourceLoggerChild.getChildren());
private Appender createAppender(final Route route, final LogEvent event) { final Node routeNode = route.getNode(); for (final Node node : routeNode.getChildren()) { if (node.getType().getElementName().equals(Appender.ELEMENT_TYPE)) { final Node appNode = new Node(node); configuration.createConfiguration(appNode, event); if (appNode.getObject() instanceof Appender) { final Appender app = appNode.getObject(); app.start(); return app; } error("Unable to create Appender of type " + node.getName()); return null; } } error("No Appender was configured for route " + route.getKey()); return null; }