You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "ppkarwasz (via GitHub)" <gi...@apache.org> on 2024/03/28 14:06:39 UTC
[PR] Deprecate `o.a.l.l.c.a.r.a.Duration` class for removal (logging-log4j2)
ppkarwasz opened a new pull request, #2425:
URL: https://github.com/apache/logging-log4j2/pull/2425
We deprecate the [`o.a.l.l.c.a.r.a.Duration`](https://logging.apache.org/log4j/2.x/javadoc/log4j-core/org/apache/logging/log4j/core/appender/rolling/action/Duration) and replace it with `java.time.Duration`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Deprecate `o.a.l.l.c.a.r.a.Duration` class for removal (logging-log4j2)
Posted by "norrisjeremy (via GitHub)" <gi...@apache.org>.
norrisjeremy commented on PR #2425:
URL: https://github.com/apache/logging-log4j2/pull/2425#issuecomment-2340011828
Hi @ppkarwasz,
Can you update the release notes for 2.24.0 to document the fact that this deprecation also means that the relaxed syntax of `with 'P' and 'T' optional` is also thus deprecated?
This is not clearly defined in the release notes and thus means consumers of [o.a.l.l.c.a.r.a.Duration](https://logging.apache.org/log4j/2.x/javadoc/log4j-core/org/apache/logging/log4j/core/appender/rolling/action/Duration) that naively migrate to `java.time.Duration` can thus suddenly encounter `java.time.format.DateTimeParseException`'s for strings that could previously be parsed without issue.
Thanks,
Jeremy
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Deprecate `o.a.l.l.c.a.r.a.Duration` class for removal (logging-log4j2)
Posted by "norrisjeremy (via GitHub)" <gi...@apache.org>.
norrisjeremy commented on code in PR #2425:
URL: https://github.com/apache/logging-log4j2/pull/2425#discussion_r1751517027
##########
log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModified.java:
##########
@@ -79,35 +79,62 @@ 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);
}
/**
- * 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
- * @return An IfLastModified condition.
+ * @deprecated since 2.24.0 use {@link #newBuilder()} instead.
*/
- @PluginFactory
+ @Deprecated
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);
+ final org.apache.logging.log4j.core.appender.rolling.action.Duration age,
+ final PathCondition... pathConditions) {
+ return newBuilder()
+ .setAge(Duration.ofMillis(age.toMillis()))
+ .setNestedConditions(pathConditions)
+ .build();
}
@Override
public String toString() {
final String nested = nestedConditions.length == 0 ? "" : " AND " + Arrays.toString(nestedConditions);
return "IfLastModified(age=" + age + nested + ")";
}
+
+ /**
+ * @since 2.24.0
+ */
+ @PluginBuilderFactory
+ public static Builder newBuilder() {
+ return new Builder();
+ }
+
+ /**
+ * @since 2.24.0
+ */
+ public static final class Builder implements org.apache.logging.log4j.core.util.Builder<IfLastModified> {
+ @PluginBuilderAttribute
+ @Required(message = "No age provided for IfLastModified")
+ private org.apache.logging.log4j.core.appender.rolling.action.Duration age;
+
+ @PluginElement("nestedConditions")
+ private PathCondition[] nestedConditions;
+
+ public Builder setAge(final Duration age) {
+ this.age = org.apache.logging.log4j.core.appender.rolling.action.Duration.ofMillis(age.toMillis());
+ return this;
+ }
+
+ public Builder setNestedConditions(final PathCondition... nestedConditions) {
Review Comment:
Shouldn't this be spelled as `withNextedConditions()` to be more consistent with other Builders syntax?
##########
log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModified.java:
##########
@@ -79,35 +79,62 @@ 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);
}
/**
- * 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
- * @return An IfLastModified condition.
+ * @deprecated since 2.24.0 use {@link #newBuilder()} instead.
*/
- @PluginFactory
+ @Deprecated
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);
+ final org.apache.logging.log4j.core.appender.rolling.action.Duration age,
+ final PathCondition... pathConditions) {
+ return newBuilder()
+ .setAge(Duration.ofMillis(age.toMillis()))
+ .setNestedConditions(pathConditions)
+ .build();
}
@Override
public String toString() {
final String nested = nestedConditions.length == 0 ? "" : " AND " + Arrays.toString(nestedConditions);
return "IfLastModified(age=" + age + nested + ")";
}
+
+ /**
+ * @since 2.24.0
+ */
+ @PluginBuilderFactory
+ public static Builder newBuilder() {
+ return new Builder();
+ }
+
+ /**
+ * @since 2.24.0
+ */
+ public static final class Builder implements org.apache.logging.log4j.core.util.Builder<IfLastModified> {
+ @PluginBuilderAttribute
+ @Required(message = "No age provided for IfLastModified")
+ private org.apache.logging.log4j.core.appender.rolling.action.Duration age;
+
+ @PluginElement("nestedConditions")
+ private PathCondition[] nestedConditions;
+
+ public Builder setAge(final Duration age) {
Review Comment:
Shouldn't this be spelled as `withAge()` to be more consistent with other Builders syntax?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Deprecate `o.a.l.l.c.a.r.a.Duration` class for removal (logging-log4j2)
Posted by "norrisjeremy (via GitHub)" <gi...@apache.org>.
norrisjeremy commented on code in PR #2425:
URL: https://github.com/apache/logging-log4j2/pull/2425#discussion_r1751540794
##########
log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModified.java:
##########
@@ -79,35 +79,62 @@ 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);
}
/**
- * 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
- * @return An IfLastModified condition.
+ * @deprecated since 2.24.0 use {@link #newBuilder()} instead.
*/
- @PluginFactory
+ @Deprecated
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);
+ final org.apache.logging.log4j.core.appender.rolling.action.Duration age,
+ final PathCondition... pathConditions) {
+ return newBuilder()
+ .setAge(Duration.ofMillis(age.toMillis()))
+ .setNestedConditions(pathConditions)
+ .build();
}
@Override
public String toString() {
final String nested = nestedConditions.length == 0 ? "" : " AND " + Arrays.toString(nestedConditions);
return "IfLastModified(age=" + age + nested + ")";
}
+
+ /**
+ * @since 2.24.0
+ */
+ @PluginBuilderFactory
+ public static Builder newBuilder() {
+ return new Builder();
+ }
+
+ /**
+ * @since 2.24.0
+ */
+ public static final class Builder implements org.apache.logging.log4j.core.util.Builder<IfLastModified> {
+ @PluginBuilderAttribute
+ @Required(message = "No age provided for IfLastModified")
+ private org.apache.logging.log4j.core.appender.rolling.action.Duration age;
+
+ @PluginElement("nestedConditions")
+ private PathCondition[] nestedConditions;
+
+ public Builder setAge(final Duration age) {
Review Comment:
Ok, understood.
Was just confused because other nearby Builder's already used the `withXyz()` syntax, so it seemed inconsistent when I encountered it here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Deprecate `o.a.l.l.c.a.r.a.Duration` class for removal (logging-log4j2)
Posted by "vy (via GitHub)" <gi...@apache.org>.
vy commented on PR #2425:
URL: https://github.com/apache/logging-log4j2/pull/2425#issuecomment-2346003562
> I also am not sure if it would be worthwhile calling out to users in the Release Notes that configuration elements such as `<IfLastModified age="7d"/>` are also thus deprecated and should be updated to syntax such as `<IfLastModified age="P7D"/>`?
@norrisjeremy, to keep the backward compatibility, Log4j 2 still uses the (deprecated) Log4j `Duration` class to read `IfLastModified#age` – the new `j.t.Duration` syntax is not supported yet. We only marked the class and its usages as deprecated to warn users accessing those fields programmatically, etc. But you have a point: Log4j 3 completely switches to `j.t.Duration` and this will break incompatible `IfLastModified` configurations. That said, Log4j 3 will be a big bang anyway... :shrug:
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Deprecate `o.a.l.l.c.a.r.a.Duration` class for removal (logging-log4j2)
Posted by "norrisjeremy (via GitHub)" <gi...@apache.org>.
norrisjeremy commented on PR #2425:
URL: https://github.com/apache/logging-log4j2/pull/2425#issuecomment-2340096726
> Hi @ppkarwasz,
>
> Can you update the release notes for 2.24.0 to document the fact that this deprecation also means that the relaxed syntax of `with 'P' and 'T' optional` is also thus deprecated? This is not clearly defined in the release notes and thus means consumers of [o.a.l.l.c.a.r.a.Duration](https://logging.apache.org/log4j/2.x/javadoc/log4j-core/org/apache/logging/log4j/core/appender/rolling/action/Duration) that naively migrate to `java.time.Duration` can thus suddenly encounter `java.time.format.DateTimeParseException`'s for strings that could previously be parsed without issue.
>
> Thanks, Jeremy
I also am not sure if it would be worthwhile calling out to users in the Release Notes that configuration elements such as `<IfLastModified age="7d"/>` are also thus deprecated and should be updated to syntax such as `<IfLastModified age="P7D"/>`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Deprecate `o.a.l.l.c.a.r.a.Duration` class for removal (logging-log4j2)
Posted by "norrisjeremy (via GitHub)" <gi...@apache.org>.
norrisjeremy commented on code in PR #2425:
URL: https://github.com/apache/logging-log4j2/pull/2425#discussion_r1751517027
##########
log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModified.java:
##########
@@ -79,35 +79,62 @@ 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);
}
/**
- * 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
- * @return An IfLastModified condition.
+ * @deprecated since 2.24.0 use {@link #newBuilder()} instead.
*/
- @PluginFactory
+ @Deprecated
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);
+ final org.apache.logging.log4j.core.appender.rolling.action.Duration age,
+ final PathCondition... pathConditions) {
+ return newBuilder()
+ .setAge(Duration.ofMillis(age.toMillis()))
+ .setNestedConditions(pathConditions)
+ .build();
}
@Override
public String toString() {
final String nested = nestedConditions.length == 0 ? "" : " AND " + Arrays.toString(nestedConditions);
return "IfLastModified(age=" + age + nested + ")";
}
+
+ /**
+ * @since 2.24.0
+ */
+ @PluginBuilderFactory
+ public static Builder newBuilder() {
+ return new Builder();
+ }
+
+ /**
+ * @since 2.24.0
+ */
+ public static final class Builder implements org.apache.logging.log4j.core.util.Builder<IfLastModified> {
+ @PluginBuilderAttribute
+ @Required(message = "No age provided for IfLastModified")
+ private org.apache.logging.log4j.core.appender.rolling.action.Duration age;
+
+ @PluginElement("nestedConditions")
+ private PathCondition[] nestedConditions;
+
+ public Builder setAge(final Duration age) {
+ this.age = org.apache.logging.log4j.core.appender.rolling.action.Duration.ofMillis(age.toMillis());
+ return this;
+ }
+
+ public Builder setNestedConditions(final PathCondition... nestedConditions) {
Review Comment:
Shouldn't this be spelled as `withNestedConditions()` to be more consistent with other Builders syntax?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Deprecate `o.a.l.l.c.a.r.a.Duration` class for removal (logging-log4j2)
Posted by "vy (via GitHub)" <gi...@apache.org>.
vy commented on code in PR #2425:
URL: https://github.com/apache/logging-log4j2/pull/2425#discussion_r1543730541
##########
log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/convert/TypeConverters.java:
##########
@@ -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<Duration> {
+ @Deprecated
+ public static class DurationConverter
+ implements TypeConverter<org.apache.logging.log4j.core.appender.rolling.action.Duration> {
+ @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<Duration> {
Review Comment:
Just checking: We don't have any usage of this yet, right?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Deprecate `o.a.l.l.c.a.r.a.Duration` class for removal (logging-log4j2)
Posted by "ppkarwasz (via GitHub)" <gi...@apache.org>.
ppkarwasz commented on code in PR #2425:
URL: https://github.com/apache/logging-log4j2/pull/2425#discussion_r1751536805
##########
log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModified.java:
##########
@@ -79,35 +79,62 @@ 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);
}
/**
- * 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
- * @return An IfLastModified condition.
+ * @deprecated since 2.24.0 use {@link #newBuilder()} instead.
*/
- @PluginFactory
+ @Deprecated
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);
+ final org.apache.logging.log4j.core.appender.rolling.action.Duration age,
+ final PathCondition... pathConditions) {
+ return newBuilder()
+ .setAge(Duration.ofMillis(age.toMillis()))
+ .setNestedConditions(pathConditions)
+ .build();
}
@Override
public String toString() {
final String nested = nestedConditions.length == 0 ? "" : " AND " + Arrays.toString(nestedConditions);
return "IfLastModified(age=" + age + nested + ")";
}
+
+ /**
+ * @since 2.24.0
+ */
+ @PluginBuilderFactory
+ public static Builder newBuilder() {
+ return new Builder();
+ }
+
+ /**
+ * @since 2.24.0
+ */
+ public static final class Builder implements org.apache.logging.log4j.core.util.Builder<IfLastModified> {
+ @PluginBuilderAttribute
+ @Required(message = "No age provided for IfLastModified")
+ private org.apache.logging.log4j.core.appender.rolling.action.Duration age;
+
+ @PluginElement("nestedConditions")
+ private PathCondition[] nestedConditions;
+
+ public Builder setAge(final Duration age) {
Review Comment:
Usually a `with*` method is provided by _immutable_ objects and creates a new instance of the object, so `set*` is more appropriate here.
In `2.x` you have a mixture of "setters" and "withers" and if both are present, the "wither" is **deprecated**.
The consensus is to replace all "withers" with "setters" in `3.x` (see #1206).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Deprecate `o.a.l.l.c.a.r.a.Duration` class for removal (logging-log4j2)
Posted by "ppkarwasz (via GitHub)" <gi...@apache.org>.
ppkarwasz commented on code in PR #2425:
URL: https://github.com/apache/logging-log4j2/pull/2425#discussion_r1751538740
##########
log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/IfLastModified.java:
##########
@@ -79,35 +79,62 @@ 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);
}
/**
- * 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
- * @return An IfLastModified condition.
+ * @deprecated since 2.24.0 use {@link #newBuilder()} instead.
*/
- @PluginFactory
+ @Deprecated
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);
+ final org.apache.logging.log4j.core.appender.rolling.action.Duration age,
+ final PathCondition... pathConditions) {
+ return newBuilder()
+ .setAge(Duration.ofMillis(age.toMillis()))
+ .setNestedConditions(pathConditions)
+ .build();
}
@Override
public String toString() {
final String nested = nestedConditions.length == 0 ? "" : " AND " + Arrays.toString(nestedConditions);
return "IfLastModified(age=" + age + nested + ")";
}
+
+ /**
+ * @since 2.24.0
+ */
+ @PluginBuilderFactory
+ public static Builder newBuilder() {
+ return new Builder();
+ }
+
+ /**
+ * @since 2.24.0
+ */
+ public static final class Builder implements org.apache.logging.log4j.core.util.Builder<IfLastModified> {
+ @PluginBuilderAttribute
+ @Required(message = "No age provided for IfLastModified")
+ private org.apache.logging.log4j.core.appender.rolling.action.Duration age;
+
+ @PluginElement("nestedConditions")
+ private PathCondition[] nestedConditions;
+
+ public Builder setAge(final Duration age) {
+ this.age = org.apache.logging.log4j.core.appender.rolling.action.Duration.ofMillis(age.toMillis());
+ return this;
+ }
+
+ public Builder setNestedConditions(final PathCondition... nestedConditions) {
Review Comment:
See comment above: new methods are introduced as "setters" so they don't need to be deprecated in `3.x`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Deprecate `o.a.l.l.c.a.r.a.Duration` class for removal (logging-log4j2)
Posted by "ppkarwasz (via GitHub)" <gi...@apache.org>.
ppkarwasz merged PR #2425:
URL: https://github.com/apache/logging-log4j2/pull/2425
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Deprecate `o.a.l.l.c.a.r.a.Duration` class for removal (logging-log4j2)
Posted by "ppkarwasz (via GitHub)" <gi...@apache.org>.
ppkarwasz commented on code in PR #2425:
URL: https://github.com/apache/logging-log4j2/pull/2425#discussion_r1544575754
##########
log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/convert/TypeConverters.java:
##########
@@ -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<Duration> {
+ @Deprecated
+ public static class DurationConverter
+ implements TypeConverter<org.apache.logging.log4j.core.appender.rolling.action.Duration> {
+ @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<Duration> {
Review Comment:
Nice catch!
For compatibility sake I had to revert the `age` field in the `IfLastModified` builder to "our" `Duration`. Therefore this one is not used.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org