docs: public int execute(String[] args, Map<String, LevelDetails> levels, String[] header) {
  
          levelString = getLevelsString(levels);
  
          RepositoryReaderImpl logRepository;
          try {
              // Parse the command line arguments and validate arguments
              if (parseCmdLineArgs(args) || validateSettings()) {
                  return 0;
              }
  
              // Setup custom header here since parseCmdLineArgs may alter the formatter.
              if (header != null) {
                  theFormatter.setCustomHeader(header);
              }
  
              // Call HPEL repository API to get log entries
              logRepository = new RepositoryReaderImpl(binaryRepositoryDir);
  
              if (mainInstanceId != null) {
                  // Verify requested instance ID.
                  ServerInstanceLogRecordList silrl = logRepository.getLogListForServerInstance(mainInstanceId);
                  if (silrl == null || silrl.getStartTime() == null || !silrl.getStartTime().equals(mainInstanceId) ||
                      (subInstanceId != null && !subInstanceId.isEmpty() && !silrl.getChildren().containsKey(subInstanceId))) {
                      throw new IllegalArgumentException(getLocalizedString("LVM_ERROR_INSTANCEID"));
                  }
              }
  
              // Create the output stream (either an output file or Console)
              PrintStream outps = createOutputStream();
  
              /*
               * Create a filter object with our search criteria, passing null for startDate and stopDate as we will
               * be using the API to search by date for efficiency.
               */
              LogViewerFilter searchCriteria = new LogViewerFilter(startDate, stopDate, minLevel, maxLevel, includeLoggers, excludeLoggers, hexThreadID, message, excludeMessages, extensions);
  
              //Determine if we just display instances or start displaying records based on the -listInstances option
              if (listInstances) {
                  Iterable<ServerInstanceLogRecordList> results = logRepository.getLogLists();
                  displayInstances(outps, results);
              } else {
                  Properties initialProps = logRepository.getLogListForCurrentServerInstance().getHeader();
                  if (initialProps != null) {
  
                      boolean isZOS = "Y".equalsIgnoreCase(initialProps.getProperty(ServerInstanceLogRecordList.HEADER_ISZOS));
  
                      //instanceId is required for z/OS.  If it was not provided, then list the possible instances
                      if (isZOS && !latestInstance && mainInstanceId == null) {
                          Iterable<ServerInstanceLogRecordList> results = logRepository.getLogLists();
                          displayInstances(outps, results);
                      } else {
                          displayRecords(outps, searchCriteria, logRepository, mainInstanceId, subInstanceId);
                      }
                  }
              }
  
          } catch (IllegalArgumentException e) {
              System.err.println(e.getMessage());
              return 1;
          }
  
          return 0;
      }