private static void logErrorDuringExit(String message, Throwable err) {
    // A special class to bypass problems with logging ControlFlowException.
    class ApplicationExitException extends RuntimeException {
      ApplicationExitException(Throwable cause) {
        super(cause);
      }
    }

    if (err != null) {
      try {
        getLogger().error(message, new ApplicationExitException(err));
      }
      catch (Throwable ignored) {
        // Do nothing.
      }
    }
  }
private static void logErrorDuringExit(String message, Throwable err)