static Set<File> getActiveLogFiles() throws IOException {
    Set<File> ret = new HashSet<>();
    org.apache.logging.log4j.Logger logger = org.apache.logging.log4j.LogManager.getRootLogger();
    if (!(logger instanceof org.apache.logging.log4j.core.Logger)) {
      return ret;
    }
    org.apache.logging.log4j.core.Logger coreLogger = (org.apache.logging.log4j.core.Logger) logger;
    for (org.apache.logging.log4j.core.Appender appender : coreLogger.getAppenders().values()) {
      if (appender instanceof org.apache.logging.log4j.core.appender.FileAppender) {
        String fileName =
          ((org.apache.logging.log4j.core.appender.FileAppender) appender).getFileName();
        ret.add(new File(fileName));
      } else if (appender instanceof org.apache.logging.log4j.core.appender.AbstractFileAppender) {
        String fileName =
          ((org.apache.logging.log4j.core.appender.AbstractFileAppender<?>) appender).getFileName();
        ret.add(new File(fileName));
      } else if (appender instanceof org.apache.logging.log4j.core.appender.RollingFileAppender) {
        String fileName =
          ((org.apache.logging.log4j.core.appender.RollingFileAppender) appender).getFileName();
        ret.add(new File(fileName));
      } else
        if (appender instanceof org.apache.logging.log4j.core.appender.RandomAccessFileAppender) {
          String fileName =
            ((org.apache.logging.log4j.core.appender.RandomAccessFileAppender) appender)
              .getFileName();
          ret.add(new File(fileName));
        } else
          if (appender instanceof org.apache.logging.log4j.core.appender.MemoryMappedFileAppender) {
            String fileName =
              ((org.apache.logging.log4j.core.appender.MemoryMappedFileAppender) appender)
                .getFileName();
            ret.add(new File(fileName));
          }
    }
    return ret;
  }
The actual class for operating on log4j2.
<p/>
This class will depend on log4j directly, so callers should not use this class directly to avoid
introducing log4j2 dependencies to downstream users. Please call the methods in
{@link Log4jUtils}, as they will call the methods here through reflection.
hbase-logging/src/main/java/org/apache/hadoop/hbase/logging/InternalLog4jUtils.java