Search in sources :

Example 1 with CountingNoOpAppender

use of org.apache.logging.log4j.core.appender.CountingNoOpAppender in project elasticsearch by elastic.

the class EvilLoggerTests method testFindAppender.

public void testFindAppender() throws IOException, UserException {
    setupLogging("find_appender");
    final Logger hasConsoleAppender = ESLoggerFactory.getLogger("has_console_appender");
    final Appender testLoggerConsoleAppender = Loggers.findAppender(hasConsoleAppender, ConsoleAppender.class);
    assertNotNull(testLoggerConsoleAppender);
    assertThat(testLoggerConsoleAppender.getName(), equalTo("console"));
    final Logger hasCountingNoOpAppender = ESLoggerFactory.getLogger("has_counting_no_op_appender");
    assertNull(Loggers.findAppender(hasCountingNoOpAppender, ConsoleAppender.class));
    final Appender countingNoOpAppender = Loggers.findAppender(hasCountingNoOpAppender, CountingNoOpAppender.class);
    assertThat(countingNoOpAppender.getName(), equalTo("counting_no_op"));
}
Also used : Appender(org.apache.logging.log4j.core.Appender) ConsoleAppender(org.apache.logging.log4j.core.appender.ConsoleAppender) CountingNoOpAppender(org.apache.logging.log4j.core.appender.CountingNoOpAppender) ConsoleAppender(org.apache.logging.log4j.core.appender.ConsoleAppender) Logger(org.apache.logging.log4j.Logger)

Aggregations

Logger (org.apache.logging.log4j.Logger)1 Appender (org.apache.logging.log4j.core.Appender)1 ConsoleAppender (org.apache.logging.log4j.core.appender.ConsoleAppender)1 CountingNoOpAppender (org.apache.logging.log4j.core.appender.CountingNoOpAppender)1