org.apache.logging.log4j.core.Core Java Examples

The following examples show how to use org.apache.logging.log4j.core.Core. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ValidatingPluginWithFailoverTest.java    From logging-log4j2 with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Before
public void setUp() throws Exception {
    final PluginManager manager = new PluginManager(Core.CATEGORY_NAME);
    manager.collectPlugins();
    plugin = (PluginType<FailoverAppender>) manager.getPluginType("failover");
    assertNotNull("Rebuild this module to make sure annotation processing kicks in.", plugin);

    AppenderRef appenderRef = AppenderRef.createAppenderRef("List", Level.ALL, null);
    node = new Node(null, "failover", plugin);
    Node failoversNode = new Node(node, "Failovers", manager.getPluginType("Failovers"));
    Node appenderRefNode  = new Node(failoversNode, "appenderRef", manager.getPluginType("appenderRef"));
    appenderRefNode.getAttributes().put("ref", "file");
    appenderRefNode.setObject(appenderRef);
    failoversNode.getChildren().add(appenderRefNode);
    failoversNode.setObject(FailoversPlugin.createFailovers(appenderRef));
    node.getAttributes().put("primary", "CONSOLE");
    node.getAttributes().put("name", "Failover");
    node.getChildren().add(failoversNode);
}