From 80db86b54892d5af85b6ee69b1e97a097f64f6bd Mon Sep 17 00:00:00 2001 From: Ceki Gulcu Date: Fri, 27 Dec 2024 18:07:31 +0100 Subject: [PATCH] fix issues/860 Signed-off-by: Ceki Gulcu --- .../ch/qos/logback/core/CoreConstants.java | 3 +- .../core/rolling/SizeAndTimeBasedFNATP.java | 39 +++++++++++++++++++ ...imeBasedFileNamingAndTriggeringPolicy.java | 8 +++- 3 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 logback-core/src/main/java/ch/qos/logback/core/rolling/SizeAndTimeBasedFNATP.java diff --git a/logback-core/src/main/java/ch/qos/logback/core/CoreConstants.java b/logback-core/src/main/java/ch/qos/logback/core/CoreConstants.java index d5adbfc614..47b96f5bbf 100644 --- a/logback-core/src/main/java/ch/qos/logback/core/CoreConstants.java +++ b/logback-core/src/main/java/ch/qos/logback/core/CoreConstants.java @@ -250,7 +250,8 @@ public class CoreConstants { public static final int UNBOUND_HISTORY = UNBOUNDED_HISTORY; //public static final String RECONFIGURE_ON_CHANGE_TASK = "RECONFIGURE_ON_CHANGE_TASK"; - public static final String SIZE_AND_TIME_BASED_FNATP_IS_DEPRECATED = "SizeAndTimeBasedFileNamingAndTriggeringPolicy is deprecated. Use SizeAndTimeBasedRollingPolicy instead"; + public static final String SIZE_AND_TIME_BASED_FNATP_IS_DEPRECATED = "Direct use of either SizeAndTimeBasedFNATP or SizeAndTimeBasedFileNamingAndTriggeringPolicy "; + public static final String SIZE_AND_TIME_BASED_FNATP_IS_DEPRECATED_BIS = "is deprecated. Please use SizeAndTimeBasedRollingPolicy instead."; public static final char JSON_LINE_SEPARATOR = '\n'; final public static String MODEL_CONFIG_FILE_EXTENSION = ".scmo"; diff --git a/logback-core/src/main/java/ch/qos/logback/core/rolling/SizeAndTimeBasedFNATP.java b/logback-core/src/main/java/ch/qos/logback/core/rolling/SizeAndTimeBasedFNATP.java new file mode 100644 index 0000000000..badc5d2463 --- /dev/null +++ b/logback-core/src/main/java/ch/qos/logback/core/rolling/SizeAndTimeBasedFNATP.java @@ -0,0 +1,39 @@ +/* + * Logback: the reliable, generic, fast and flexible logging framework. + * Copyright (C) 1999-2024, QOS.ch. All rights reserved. + * + * This program and the accompanying materials are dual-licensed under + * either the terms of the Eclipse Public License v1.0 as published by + * the Eclipse Foundation + * + * or (per the licensee's choosing) + * + * under the terms of the GNU Lesser General Public License version 2.1 + * as published by the Free Software Foundation. + */ + +package ch.qos.logback.core.rolling; + +import static ch.qos.logback.core.CoreConstants.MANUAL_URL_PREFIX; + +/** + *

{@link SizeAndTimeBasedFNATP} class was renamed as {@link SizeAndTimeBasedFileNamingAndTriggeringPolicy} + * in version 1.5.8. In version 1.5.16 it was reintroduced to preserve backward compatibility with existing + * configurations.

+ * + * + * + * @since removed in 1.5.8 and reintroduced in 1.5.16 + */ + +public class SizeAndTimeBasedFNATP extends SizeAndTimeBasedFileNamingAndTriggeringPolicy { + + + @Override + public void start() { + addWarn("SizeAndTimeBasedFNATP class was renamed as SizeAndTimeBasedFileNamingAndTriggeringPolicy."); + super.start(); + } + + +} diff --git a/logback-core/src/main/java/ch/qos/logback/core/rolling/SizeAndTimeBasedFileNamingAndTriggeringPolicy.java b/logback-core/src/main/java/ch/qos/logback/core/rolling/SizeAndTimeBasedFileNamingAndTriggeringPolicy.java index b12a522677..d03a6680a6 100644 --- a/logback-core/src/main/java/ch/qos/logback/core/rolling/SizeAndTimeBasedFileNamingAndTriggeringPolicy.java +++ b/logback-core/src/main/java/ch/qos/logback/core/rolling/SizeAndTimeBasedFileNamingAndTriggeringPolicy.java @@ -28,11 +28,16 @@ /** * This class implement {@link TimeBasedFileNamingAndTriggeringPolicy} * interface extending {@link TimeBasedFileNamingAndTriggeringPolicyBase}. This class is intended to be nested - * within a {@link SizeAndTimeBasedFileNamingAndTriggeringPolicy} instance. However, it can also be instantiated directly for testing purposes. + * within a {@link SizeAndTimeBasedFileNamingAndTriggeringPolicy} instance. However, it can also be + * instantiated directly for testing purposes. + * + *

{@link SizeAndTimeBasedFNATP} class was renamed as {@link SizeAndTimeBasedFileNamingAndTriggeringPolicy} + * in version 1.5.8.

* * @author Ceki Gülcü * * @param + * @since 1.5.8 */ @NoAutoStart public class SizeAndTimeBasedFileNamingAndTriggeringPolicy extends TimeBasedFileNamingAndTriggeringPolicyBase { @@ -72,6 +77,7 @@ public void start() { if (usage == Usage.DIRECT) { addWarn(CoreConstants.SIZE_AND_TIME_BASED_FNATP_IS_DEPRECATED); + addWarn(CoreConstants.SIZE_AND_TIME_BASED_FNATP_IS_DEPRECATED_BIS); addWarn("For more information see " + MANUAL_URL_PREFIX + "appenders.html#SizeAndTimeBasedRollingPolicy"); }