public static void main(final String... args) throws IOException {
    File mergeFile = null;
    List<File> files = new ArrayList<>();
    int dirCount = 0;
    boolean findPIDs = false;
    boolean tabOut = false;
    boolean suppressBlanks = false;
    boolean multithreaded = false;
    List<String> patterns = new LinkedList<>();

    // Parse command line
    for (int i = 0; i < args.length; i++) {
      switch (args[i]) {
        case "-align":
          tabOut = true;
          break;
        case "-noblanks":
          suppressBlanks = true;
          break;
        case "-pids":
          findPIDs = true;
          break;
        case "-threaded":
          multithreaded = true;
          break;
        case "-regex":
          if (i + 1 >= args.length) {
            usage("missing pattern for -regex option");
          }
          patterns.add(args[i + 1]);
          i++;
          break;
        case "-dirCount":
          if (++i >= args.length) {
            usage("Missing number of parent directories");
          }

          try {
            dirCount = Integer.parseInt(args[i]);

          } catch (NumberFormatException ex) {
            usage(String.format("Not a number: %s", args[i]));
          }

          break;
        case "-mergeFile":
          if (++i >= args.length) {
            usage("Missing merge file name");
          }

          mergeFile = new File(args[i]);

          break;
        default:
          File file = new File(args[i]);
          if (!file.exists()) {
            usage(String.format("File %s does not exist", file));
          }

          files.add(file.getAbsoluteFile());
          break;
      }
    } // for
    if (files.isEmpty()) {
      usage("Missing filename");
    }

    // Expand directory names found in list
    List<File> expandedFiles = new ArrayList<>();
    for (File file : files) {
      String path = file.getAbsolutePath();
      if (!file.exists()) {
        usage(String.format("File %s does not exist", path));
      }
      if (file.isFile()) {
        expandedFiles.add(file);
        continue;
      }
      if (file.isDirectory()) {
        List<File> moreFiles = getLogFiles(path);
        expandedFiles.addAll(moreFiles);
        continue;
      }
      usage(String.format("File '%s' is neither a file nor a directory.", path));
    }
    Collections.sort(expandedFiles);
    files = expandedFiles;

    // Create output stream
    PrintStream ps;
    if (mergeFile != null) {
      FileOutputStream fileOutputStream = new FileOutputStream(mergeFile);
      try {
        ps = new PrintStream(fileOutputStream, true);
      } catch (Exception ex) {
        fileOutputStream.close();
        throw ex;
      }
    } else {
      ps = out;
    }

    PrintWriter mergedFile = new PrintWriter(ps, true);

    ps.println("Merged files (count = " + expandedFiles.size() + ") input list:");
    for (File expandedFile : expandedFiles) {
      ps.println("  " + expandedFile);
    }
    ps.println();

    List nickNames = null;
    if (findPIDs) {
      nickNames = findPIDs(files, mergedFile);
    }

    Map<String, DisplayNameAndFileStream> logFiles =
        getStringDisplayNameAndFileStreamMap(files, dirCount, findPIDs, nickNames);

    mergeLogFiles(logFiles, mergedFile, tabOut, suppressBlanks, multithreaded,
        patterns);

    ExitCode.NORMAL.doSystemExit();
  }
Find all of the .log files in the given directory

@param dirName directory to search
@return all of the .log files found (Files)
geode-core/src/main/java/org/apache/geode/internal/logging/MergeLogFiles.java