code: protected static boolean isFileAppender(Appender appender) {
  
          boolean result = false;
          try {
              Method getFileNameMethod = appender.getClass().getDeclaredMethod("getFileName", (Class<?>[])null);
              result = getFileNameMethod != null;
  
          } catch (Exception e) {
              LOG.debug(e.getLocalizedMessage(), e);
          }
          return result;
      }
docs: Checks whether the given log appender has a getFileName method to identify file based appenders.<p>
  As since log4j 2.0 file appenders don't have one common super class that allows access to the file name,
  but they all implement a method 'getFileName'.<p>
  
  @param appender the appender to check
  
  @return in case of a file based appender