From d055d450695e000b1b11c36ab096dcbcdcd65da0 Mon Sep 17 00:00:00 2001 From: "Piotr P. Karwasz" Date: Thu, 28 Mar 2024 15:03:58 +0100 Subject: [PATCH 1/6] Deprecate `o.a.l.l.c.a.r.a.Duration` class for removal --- .../rolling/action/IfLastModifiedTest.java | 7 +---- .../appender/rolling/action/Duration.java | 9 ++++++ .../rolling/action/IfLastModified.java | 28 ++++++++++++++----- .../appender/rolling/action/package-info.java | 2 +- .../plugins/convert/TypeConverters.java | 21 ++++++++++++-- .../config/plugins/convert/package-info.java | 2 +- src/changelog/.2.x.x/deprecate_duration.xml | 7 +++++ 7 files changed, 58 insertions(+), 18 deletions(-) create mode 100644 src/changelog/.2.x.x/deprecate_duration.xml diff --git a/log4j-core-test/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModifiedTest.java b/log4j-core-test/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModifiedTest.java index 333af1ebd46..7160fa14f45 100644 --- a/log4j-core-test/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModifiedTest.java +++ b/log4j-core-test/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModifiedTest.java @@ -23,6 +23,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import java.nio.file.attribute.FileTime; +import java.time.Duration; import java.util.List; import org.apache.logging.log4j.core.config.Node; import org.apache.logging.log4j.core.config.NullConfiguration; @@ -43,12 +44,6 @@ @SetSystemProperty(key = "log4j2.status.entries", value = "10") class IfLastModifiedTest { - @Test - public void testGetDurationReturnsConstructorValue() { - final IfLastModified filter = IfLastModified.createAgeCondition(Duration.parse("P7D")); - assertEquals(0, filter.getAge().compareTo(Duration.parse("P7D"))); - } - @Test public void testAcceptsIfFileAgeEqualToDuration() { final IfLastModified filter = IfLastModified.createAgeCondition(Duration.parse("PT33S")); diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/Duration.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/Duration.java index 597eceea24a..a9c4f9437b0 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/Duration.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/Duration.java @@ -30,7 +30,9 @@ * This implementation does not support fractions or negative values. * * @see #parse(CharSequence) + * @deprecated since 2.24.0 use {@link java.time.Duration} instead. */ +@Deprecated public class Duration implements Serializable, Comparable { private static final long serialVersionUID = -3756810052716342061L; @@ -66,6 +68,13 @@ public class Duration implements Serializable, Comparable { private static final Pattern PATTERN = Pattern.compile( "P?(?:([0-9]+)D)?" + "(T?(?:([0-9]+)H)?(?:([0-9]+)M)?(?:([0-9]+)?S)?)?", Pattern.CASE_INSENSITIVE); + /** + * @since 2.24.0 + */ + public static Duration ofMillis(final long millis) { + return new Duration(millis / 1000L); + } + /** * The number of seconds in the duration. */ diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModified.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModified.java index 6b15f5409f2..ede472cbddf 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModified.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModified.java @@ -19,6 +19,7 @@ import java.nio.file.Path; import java.nio.file.attribute.BasicFileAttributes; import java.nio.file.attribute.FileTime; +import java.time.Duration; import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -50,8 +51,12 @@ private IfLastModified(final Duration age, final PathCondition[] nestedCondition this.nestedConditions = PathCondition.copy(nestedConditions); } - public Duration getAge() { - return age; + /** + * @deprecated since 2.24.0 without a replacement. + */ + @Deprecated + public org.apache.logging.log4j.core.appender.rolling.action.Duration getAge() { + return org.apache.logging.log4j.core.appender.rolling.action.Duration.ofMillis(age.toMillis()); } public List getNestedConditions() { @@ -89,20 +94,29 @@ public void beforeFileTreeWalk() { IfAll.beforeFileTreeWalk(nestedConditions); } + /** + * @deprecated since 2.24.0 use {@link #createAgeCondition(Duration, PathCondition...)} instead. + */ + @Deprecated + public static IfLastModified createAgeCondition( + final org.apache.logging.log4j.core.appender.rolling.action.Duration age, + final PathCondition... pathConditions) { + return createAgeCondition(Duration.ofMillis(age.toMillis()), pathConditions); + } + /** * Create an IfLastModified condition. * * @param age The path age that is accepted by this condition. Must be a valid Duration. - * @param nestedConditions nested conditions to evaluate if this condition accepts a path + * @param pathConditions Nested conditions to evaluate if this condition accepts a path. * @return An IfLastModified condition. + * @since 2.24.0 */ @PluginFactory public static IfLastModified createAgeCondition( - // @formatter:off @PluginAttribute("age") @Required(message = "No age provided for IfLastModified") final Duration age, - @PluginElement("PathConditions") final PathCondition... nestedConditions) { - // @formatter:on - return new IfLastModified(age, nestedConditions); + @PluginElement("pathConditions") final PathCondition... pathConditions) { + return new IfLastModified(age, Objects.requireNonNull(pathConditions)); } @Override diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/package-info.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/package-info.java index 76054597368..4e9d1a1bb9d 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/package-info.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/package-info.java @@ -18,7 +18,7 @@ * Support classes for the Rolling File Appender. */ @Export -@Version("2.20.2") +@Version("2.24.0") package org.apache.logging.log4j.core.appender.rolling.action; import org.osgi.annotation.bundle.Export; diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/convert/TypeConverters.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/convert/TypeConverters.java index 987e68e9cc4..396dea94a4e 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/convert/TypeConverters.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/convert/TypeConverters.java @@ -32,11 +32,11 @@ import java.nio.file.Paths; import java.security.Provider; import java.security.Security; +import java.time.Duration; import java.util.UUID; import java.util.regex.Pattern; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Logger; -import org.apache.logging.log4j.core.appender.rolling.action.Duration; import org.apache.logging.log4j.core.config.plugins.Plugin; import org.apache.logging.log4j.core.util.CronExpression; import org.apache.logging.log4j.status.StatusLogger; @@ -224,11 +224,26 @@ public Double convert(final String s) { } /** - * Converts a {@link String} into a {@link Duration}. + * Converts a {@link String} into a {@link org.apache.logging.log4j.core.appender.rolling.action.Duration}. * @since 2.5 + * @deprecated since 2.24.0 use {@link JavaDurationConverter} */ @Plugin(name = "Duration", category = CATEGORY) - public static class DurationConverter implements TypeConverter { + @Deprecated + public static class DurationConverter + implements TypeConverter { + @Override + public org.apache.logging.log4j.core.appender.rolling.action.Duration convert(final String s) { + return org.apache.logging.log4j.core.appender.rolling.action.Duration.parse(s); + } + } + + /** + * Converts a {@link String} into a {@link Duration}. + * @since 2.24.0 + */ + @Plugin(name = "JavaDuration", category = CATEGORY) + public static class JavaDurationConverter implements TypeConverter { @Override public Duration convert(final String s) { return Duration.parse(s); diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/convert/package-info.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/convert/package-info.java index 59da1e88bc7..a4300945314 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/convert/package-info.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/convert/package-info.java @@ -20,7 +20,7 @@ * attributes in plugin factory methods. */ @Export -@Version("2.20.2") +@Version("2.24.0") package org.apache.logging.log4j.core.config.plugins.convert; import org.osgi.annotation.bundle.Export; diff --git a/src/changelog/.2.x.x/deprecate_duration.xml b/src/changelog/.2.x.x/deprecate_duration.xml new file mode 100644 index 00000000000..f11e9c569ad --- /dev/null +++ b/src/changelog/.2.x.x/deprecate_duration.xml @@ -0,0 +1,7 @@ + + + Deprecate `org.apache.logging.log4j.core.appender.rolling.action.Duration` class for removal. + From 12ee6326e1a68a65cc5566c16822dbcbab2e3ed3 Mon Sep 17 00:00:00 2001 From: "Piotr P. Karwasz" Date: Thu, 28 Mar 2024 16:18:57 +0100 Subject: [PATCH 2/6] Backport builder from 3.x --- .../rolling/action/IfLastModifiedTest.java | 23 +++++-- .../rolling/action/IfLastModified.java | 64 ++++++++++--------- 2 files changed, 51 insertions(+), 36 deletions(-) diff --git a/log4j-core-test/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModifiedTest.java b/log4j-core-test/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModifiedTest.java index 7160fa14f45..22bf04e43f1 100644 --- a/log4j-core-test/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModifiedTest.java +++ b/log4j-core-test/src/test/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModifiedTest.java @@ -46,7 +46,8 @@ class IfLastModifiedTest { @Test public void testAcceptsIfFileAgeEqualToDuration() { - final IfLastModified filter = IfLastModified.createAgeCondition(Duration.parse("PT33S")); + final IfLastModified filter = + IfLastModified.newBuilder().setAge(Duration.parse("PT33S")).build(); final DummyFileAttributes attrs = new DummyFileAttributes(); final long age = 33 * 1000; attrs.lastModified = FileTime.fromMillis(System.currentTimeMillis() - age); @@ -55,7 +56,8 @@ public void testAcceptsIfFileAgeEqualToDuration() { @Test public void testAcceptsIfFileAgeExceedsDuration() { - final IfLastModified filter = IfLastModified.createAgeCondition(Duration.parse("PT33S")); + final IfLastModified filter = + IfLastModified.newBuilder().setAge(Duration.parse("PT33S")).build(); final DummyFileAttributes attrs = new DummyFileAttributes(); final long age = 33 * 1000 + 5; attrs.lastModified = FileTime.fromMillis(System.currentTimeMillis() - age); @@ -64,7 +66,8 @@ public void testAcceptsIfFileAgeExceedsDuration() { @Test public void testDoesNotAcceptIfFileAgeLessThanDuration() { - final IfLastModified filter = IfLastModified.createAgeCondition(Duration.parse("PT33S")); + final IfLastModified filter = + IfLastModified.newBuilder().setAge(Duration.parse("PT33S")).build(); final DummyFileAttributes attrs = new DummyFileAttributes(); final long age = 33 * 1000 - 5; attrs.lastModified = FileTime.fromMillis(System.currentTimeMillis() - age); @@ -74,7 +77,10 @@ public void testDoesNotAcceptIfFileAgeLessThanDuration() { @Test public void testAcceptCallsNestedConditionsOnlyIfPathAccepted() { final CountingCondition counter = new CountingCondition(true); - final IfLastModified filter = IfLastModified.createAgeCondition(Duration.parse("PT33S"), counter); + final IfLastModified filter = IfLastModified.newBuilder() + .setAge(Duration.parse("PT33S")) + .setNestedConditions(counter) + .build(); final DummyFileAttributes attrs = new DummyFileAttributes(); final long oldEnough = 33 * 1000 + 5; attrs.lastModified = FileTime.fromMillis(System.currentTimeMillis() - oldEnough); @@ -99,8 +105,10 @@ public void testAcceptCallsNestedConditionsOnlyIfPathAccepted() { @Test public void testBeforeTreeWalk() { final CountingCondition counter = new CountingCondition(true); - final IfLastModified filter = - IfLastModified.createAgeCondition(Duration.parse("PT33S"), counter, counter, counter); + final IfLastModified filter = IfLastModified.newBuilder() + .setAge(Duration.parse("PT33S")) + .setNestedConditions(counter, counter, counter) + .build(); filter.beforeFileTreeWalk(); assertEquals(3, counter.getBeforeFileTreeWalkCount()); } @@ -108,7 +116,8 @@ public void testBeforeTreeWalk() { @Test public void testCreateAgeConditionCalledProgrammaticallyThrowsNPEWhenAgeIsNotSpecified() { Duration age = null; - assertThrows(NullPointerException.class, () -> IfLastModified.createAgeCondition(age)); + assertThrows( + NullPointerException.class, () -> IfLastModified.newBuilder().setAge(age)); } @ParameterizedTest diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModified.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModified.java index ede472cbddf..031789ecf03 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModified.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModified.java @@ -27,7 +27,7 @@ import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.core.Core; import org.apache.logging.log4j.core.config.plugins.Plugin; -import org.apache.logging.log4j.core.config.plugins.PluginAttribute; +import org.apache.logging.log4j.core.config.plugins.PluginBuilderAttribute; import org.apache.logging.log4j.core.config.plugins.PluginElement; import org.apache.logging.log4j.core.config.plugins.PluginFactory; import org.apache.logging.log4j.core.config.plugins.validation.constraints.Required; @@ -63,12 +63,6 @@ public List getNestedConditions() { return Collections.unmodifiableList(Arrays.asList(nestedConditions)); } - /* - * (non-Javadoc) - * - * @see org.apache.logging.log4j.core.appender.rolling.action.PathCondition#accept(java.nio.file.Path, - * java.nio.file.Path, java.nio.file.attribute.BasicFileAttributes) - */ @Override public boolean accept(final Path basePath, final Path relativePath, final BasicFileAttributes attrs) { final FileTime fileTime = attrs.lastModifiedTime(); @@ -84,39 +78,22 @@ public boolean accept(final Path basePath, final Path relativePath, final BasicF return result; } - /* - * (non-Javadoc) - * - * @see org.apache.logging.log4j.core.appender.rolling.action.PathCondition#beforeFileTreeWalk() - */ @Override public void beforeFileTreeWalk() { IfAll.beforeFileTreeWalk(nestedConditions); } /** - * @deprecated since 2.24.0 use {@link #createAgeCondition(Duration, PathCondition...)} instead. + * @deprecated since 2.24.0 use {@link #newBuilder()} instead. */ @Deprecated public static IfLastModified createAgeCondition( final org.apache.logging.log4j.core.appender.rolling.action.Duration age, final PathCondition... pathConditions) { - return createAgeCondition(Duration.ofMillis(age.toMillis()), pathConditions); - } - - /** - * Create an IfLastModified condition. - * - * @param age The path age that is accepted by this condition. Must be a valid Duration. - * @param pathConditions Nested conditions to evaluate if this condition accepts a path. - * @return An IfLastModified condition. - * @since 2.24.0 - */ - @PluginFactory - public static IfLastModified createAgeCondition( - @PluginAttribute("age") @Required(message = "No age provided for IfLastModified") final Duration age, - @PluginElement("pathConditions") final PathCondition... pathConditions) { - return new IfLastModified(age, Objects.requireNonNull(pathConditions)); + return newBuilder() + .setAge(Duration.ofMillis(age.toMillis())) + .setNestedConditions(pathConditions) + .build(); } @Override @@ -124,4 +101,33 @@ public String toString() { final String nested = nestedConditions.length == 0 ? "" : " AND " + Arrays.toString(nestedConditions); return "IfLastModified(age=" + age + nested + ")"; } + + @PluginFactory + public static Builder newBuilder() { + return new Builder(); + } + + public static final class Builder implements org.apache.logging.log4j.core.util.Builder { + @PluginBuilderAttribute + @Required(message = "No age provided for IfLastModified") + private Duration age; + + @PluginElement("nestedConditions") + private PathCondition[] nestedConditions; + + public Builder setAge(final Duration age) { + this.age = age; + return this; + } + + public Builder setNestedConditions(final PathCondition... nestedConditions) { + this.nestedConditions = nestedConditions; + return this; + } + + @Override + public IfLastModified build() { + return isValid() ? new IfLastModified(age, nestedConditions) : null; + } + } } From 8660c3e4a3a0f51cbdf5081f13bcb0a7ce78349c Mon Sep 17 00:00:00 2001 From: "Piotr P. Karwasz" Date: Thu, 28 Mar 2024 16:48:42 +0100 Subject: [PATCH 3/6] Add `@since` tags --- .../core/appender/rolling/action/IfLastModified.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModified.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModified.java index 031789ecf03..0905f9374a2 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModified.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModified.java @@ -37,6 +37,7 @@ /** * PathCondition that accepts paths that are older than the specified duration. + * @since 2.5 */ @Plugin(name = "IfLastModified", category = Core.CATEGORY_NAME, printObject = true) public final class IfLastModified implements PathCondition { @@ -52,7 +53,7 @@ private IfLastModified(final Duration age, final PathCondition[] nestedCondition } /** - * @deprecated since 2.24.0 without a replacement. + * @deprecated since 2.24.0. In 3.0.0 the signature will change. */ @Deprecated public org.apache.logging.log4j.core.appender.rolling.action.Duration getAge() { @@ -102,11 +103,17 @@ public String toString() { return "IfLastModified(age=" + age + nested + ")"; } + /** + * @since 2.24.0 + */ @PluginFactory public static Builder newBuilder() { return new Builder(); } + /** + * @since 2.24.0 + */ public static final class Builder implements org.apache.logging.log4j.core.util.Builder { @PluginBuilderAttribute @Required(message = "No age provided for IfLastModified") From c2e0dc22b47fe6038e16c4af0d2b636eae992e0e Mon Sep 17 00:00:00 2001 From: "Piotr P. Karwasz" Date: Thu, 28 Mar 2024 16:59:49 +0100 Subject: [PATCH 4/6] Use deprecated class internally in builder By using the deprecated class internally, we benefit from the more lax parsing rules, withouth exposing the class in the API. --- .../log4j/core/appender/rolling/action/IfLastModified.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModified.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModified.java index 0905f9374a2..de53bfaa7a8 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModified.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModified.java @@ -117,13 +117,13 @@ public static Builder newBuilder() { public static final class Builder implements org.apache.logging.log4j.core.util.Builder { @PluginBuilderAttribute @Required(message = "No age provided for IfLastModified") - private Duration age; + private org.apache.logging.log4j.core.appender.rolling.action.Duration age; @PluginElement("nestedConditions") private PathCondition[] nestedConditions; public Builder setAge(final Duration age) { - this.age = age; + this.age = org.apache.logging.log4j.core.appender.rolling.action.Duration.ofMillis(age.toMillis()); return this; } From ea83bb7c975f716b539d790c411c7fa19724887d Mon Sep 17 00:00:00 2001 From: "Piotr P. Karwasz" Date: Thu, 28 Mar 2024 17:26:47 +0100 Subject: [PATCH 5/6] Fix test failures --- .../log4j/core/appender/rolling/action/IfLastModified.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModified.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModified.java index de53bfaa7a8..e8a105edf5f 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModified.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModified.java @@ -28,8 +28,8 @@ import org.apache.logging.log4j.core.Core; import org.apache.logging.log4j.core.config.plugins.Plugin; import org.apache.logging.log4j.core.config.plugins.PluginBuilderAttribute; +import org.apache.logging.log4j.core.config.plugins.PluginBuilderFactory; import org.apache.logging.log4j.core.config.plugins.PluginElement; -import org.apache.logging.log4j.core.config.plugins.PluginFactory; import org.apache.logging.log4j.core.config.plugins.validation.constraints.Required; import org.apache.logging.log4j.core.util.Clock; import org.apache.logging.log4j.core.util.ClockFactory; @@ -106,7 +106,7 @@ public String toString() { /** * @since 2.24.0 */ - @PluginFactory + @PluginBuilderFactory public static Builder newBuilder() { return new Builder(); } @@ -134,7 +134,7 @@ public Builder setNestedConditions(final PathCondition... nestedConditions) { @Override public IfLastModified build() { - return isValid() ? new IfLastModified(age, nestedConditions) : null; + return isValid() ? new IfLastModified(Duration.ofMillis(age.toMillis()), nestedConditions) : null; } } } From b1c9cd8b62a19e0753e55351c29a74ed4e1b35a6 Mon Sep 17 00:00:00 2001 From: "Piotr P. Karwasz" Date: Fri, 29 Mar 2024 15:32:14 +0100 Subject: [PATCH 6/6] Remove `java.time.Duration` converter --- .../config/plugins/convert/TypeConverters.java | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/convert/TypeConverters.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/convert/TypeConverters.java index 396dea94a4e..3e005f07c5d 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/convert/TypeConverters.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/convert/TypeConverters.java @@ -32,7 +32,6 @@ import java.nio.file.Paths; import java.security.Provider; import java.security.Security; -import java.time.Duration; import java.util.UUID; import java.util.regex.Pattern; import org.apache.logging.log4j.Level; @@ -226,7 +225,7 @@ public Double convert(final String s) { /** * Converts a {@link String} into a {@link org.apache.logging.log4j.core.appender.rolling.action.Duration}. * @since 2.5 - * @deprecated since 2.24.0 use {@link JavaDurationConverter} + * @deprecated since 2.24.0. A {@link java.time.Duration} converter will be available in 3.0.0. */ @Plugin(name = "Duration", category = CATEGORY) @Deprecated @@ -238,18 +237,6 @@ public org.apache.logging.log4j.core.appender.rolling.action.Duration convert(fi } } - /** - * Converts a {@link String} into a {@link Duration}. - * @since 2.24.0 - */ - @Plugin(name = "JavaDuration", category = CATEGORY) - public static class JavaDurationConverter implements TypeConverter { - @Override - public Duration convert(final String s) { - return Duration.parse(s); - } - } - /** * Converts a {@link String} into a {@link File}. */