private static void setupLogging(@NotNull GradleExecutionSettings settings,
                                   @Nullable BuildEnvironment buildEnvironment) {
    var arguments = settings.getArguments();
    var options = GradleCommandLineOptionsProvider.LOGGING_OPTIONS.getOptions();
    var optionsNames = GradleCommandLineOptionsProvider.getAllOptionsNames(options);

    // workaround for https://github.com/gradle/gradle/issues/19340
    // when using TAPI, user-defined log level option in gradle.properties is ignored by Gradle.
    // try to read this file manually and apply log level explicitly
    if (buildEnvironment == null || !isRootDirAvailable(buildEnvironment)) {
      return;
    }
    GradleProperties properties = GradlePropertiesFile.INSTANCE.getProperties(settings.getServiceDirectory(),
                                                                              buildEnvironment.getBuildIdentifier().getRootDir().toPath());
    Property<String> loggingLevelProperty = properties.getGradleLoggingLevel();
    @NonNls String gradleLogLevel = loggingLevelProperty != null ? loggingLevelProperty.getValue() : null;

    if (!ContainerUtil.exists(optionsNames, it -> arguments.contains(it))
        && gradleLogLevel != null) {
      try {
        LogLevel logLevel = LogLevel.valueOf(gradleLogLevel.toUpperCase());
        switch (logLevel) {
          case DEBUG -> settings.withArgument("-d");
          case INFO -> settings.withArgument("-i");
          case WARN -> settings.withArgument("-w");
          case QUIET -> settings.withArgument("-q");
        }
      }
      catch (IllegalArgumentException e) {
        LOG.warn("org.gradle.logging.level must be one of quiet, warn, lifecycle, info, or debug");
      }
    }

    // Default logging level for integration tests
    final Application application = ApplicationManager.getApplication();
    if (application != null && application.isUnitTestMode()) {
      if (!ContainerUtil.exists(optionsNames, it -> arguments.contains(it))) {
        settings.withArgument("--info");
      }
    }
  }
private static void setupLogging(@NotNull GradleExecutionSettings settings,
                                   @Nullable BuildEnvironment buildEnvironment)