@VisibleForTesting
  public void addToLogger(String loggerName, Level level) {
    LoggerConfig loggerConfig = configuration.getLoggerConfig(loggerName);
    loggerConfig.addAppender(this, level, null);
    context.updateLoggers();
  }
A log4J2 Appender that simply counts logging events in four levels:
fatal, error, warn and info. The class name can be used in log4j2.properties
ql/src/java/org/apache/hadoop/hive/ql/log/HiveEventCounter.java