Repository: jenkinsci/jenkins
File: core/src/main/java/jenkins/util/SystemProperties.java (Java)

Code before:
    }

    /**
     * Determines the duration value of the system property with the specified name, or a default value.
     * @param name property name.
     * @param defaultValue a default value
     * @return the property value as a duration.
     * @since TODO
     */
    @Nullable
    public static Duration getDuration(@NonNull String name, @CheckForNull Duration defaultValue) {
        return getDuration(name, defaultValue, Level.CONFIG);
    }

    /**
     * Determines the duration value of the system property with the specified name, or a default value.
     *
     * @param name         property name.
     * @param unit         the duration unit to use if the value doesn't specify one (defaults to `ms`)
     * @param defaultValue a default value
     * @return the property value as a duration.
     * @since TODO
     */
    @Nullable
    public static Duration getDuration(@NonNull String name, @CheckForNull ChronoUnit unit, @CheckForNull Duration defaultValue) {
        return getDuration(name, unit, defaultValue, Level.CONFIG);
    }

    /**
     * Determines the duration value of the system property with the specified name, or a default value.
     * @param name property name.
     * @param defaultValue a default value
     * @param logLevel the level of the log if the provided system property name cannot be parsed into Duration.
     * @return the property value as a duration.
     * @since TODO
     */
    @Nullable
    public static Duration getDuration(@NonNull String name, @CheckForNull Duration defaultValue, @NonNull Level logLevel) {
        return getDuration(name, null, defaultValue, logLevel);
    }

    /**
     * Determines the duration value of the system property with the specified name, or a default value.
     *
     * @param name         property name.
     * @param unit         the duration unit to use if the value doesn't specify one (defaults to `ms`)
     * @param defaultValue a default value
     * @param logLevel     the level of the log if the provided system property name cannot be parsed into Duration.
     * @return the property value as a duration.
     * @since TODO
     */

Review comment (suggestion):
```suggestion
        return getDuration(name, unit, defaultValue, Level.WARNING);
```

Code after:
    }

    /**
     * Determines the duration value of the system property with the specified name, or a default value.
     * @param name property name.
     * @param defaultValue a default value
     * @return the property value as a duration.
     * @since TODO
     */
    @Nullable
    public static Duration getDuration(@NonNull String name, @CheckForNull Duration defaultValue) {
        return getDuration(name, null, defaultValue);
    }

    /**
     * Determines the duration value of the system property with the specified name, or a default value.
     *
     * @param name         property name.
     * @param unit         the duration unit to use if the value doesn't specify one (defaults to `ms`)
     * @param defaultValue a default value
     * @return the property value as a duration.
     * @since TODO
     */
    @Nullable
    public static Duration getDuration(@NonNull String name, @CheckForNull ChronoUnit unit, @CheckForNull Duration defaultValue) {
        String v = getString(name);
        if (v != null) {
            try {
                return DurationStyle.detectAndParse(v, unit);
            } catch (Exception e) {
                LOGGER.log(Level.WARNING, e, () -> "Failed to convert \"%s\" to a valid duration for property \"%s\", falling back to default \"%s\"".formatted(v, name, defaultValue));
            }
        }
        return defaultValue;
    }

    /**
      * Determines the integer value of the system property with the
      * specified name.
      *
      * This behaves just like {@link Integer#getInteger(java.lang.String)}, except that it
      * also consults the {@link ServletContext}'s "init" parameters.
      *
      * @param   name property name.
      * @return  the {@code Integer} value of the property.
      */
    @CheckForNull
    public static Integer getInteger(String name) {
        return getInteger(name, null);
    }