@Test
  public void test() throws IOException {
    AtomicReference<org.apache.logging.log4j.Level> level = new AtomicReference<>();
    AtomicReference<String> msg = new AtomicReference<String>();
    doAnswer(new Answer<Void>() {

      @Override
      public Void answer(InvocationOnMock invocation) throws Throwable {
        org.apache.logging.log4j.core.LogEvent logEvent =
          invocation.getArgument(0, org.apache.logging.log4j.core.LogEvent.class);
        level.set(logEvent.getLevel());
        msg.set(logEvent.getMessage().getFormattedMessage());
        return null;
      }
    }).when(mockAppender).append(any(org.apache.logging.log4j.core.LogEvent.class));
    java.util.logging.Logger logger = java.util.logging.Logger.getLogger(loggerName);
    logger.info(loggerName);
    verify(mockAppender, times(1)).append(any(org.apache.logging.log4j.core.LogEvent.class));
    assertEquals(org.apache.logging.log4j.Level.INFO, level.get());
    assertEquals(loggerName, msg.get());
  }
This should be in the hbase-logging module but the {@link HBaseClassTestRule} is in hbase-common
so we can only put the class in hbase-common module for now...
hbase-common/src/test/java/org/apache/hadoop/hbase/logging/TestJul2Slf4j.java