@PluginFactory
  public static HiveEventCounter createInstance(@PluginAttribute("name") String name,
      @PluginAttribute("ignoreExceptions") boolean ignoreExceptions,
      @PluginElement("Layout") Layout layout,
      @PluginElement("Filters") Filter filter) {
    if (name == null) {
      name = APPENDER_NAME;
    }

    if (layout == null) {
      layout = PatternLayout.createDefaultLayout();
    }
    return new HiveEventCounter(name, filter, layout, ignoreExceptions);
  }
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