Skip to content

Commit f5b3bc5

Browse files
committed
add warning about the deprecation of SerializedModelConfigurator if activated
Signed-off-by: Ceki Gulcu <[email protected]>
1 parent 5610c96 commit f5b3bc5

File tree

4 files changed

+115
-0
lines changed

4 files changed

+115
-0
lines changed

logback-classic/src/main/java/ch/qos/logback/classic/joran/SerializedModelConfigurator.java

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public ExecutionStatus configure(LoggerContext loggerContext) {
5959

6060
URL url = performMultiStepModelFileSearch(true);
6161
if (url != null) {
62+
addWarn("Replaced by logback-tyler, SerializedModelConfigurator has been deprecated and will be removed on 2025-07-01.");
6263
configureByResource(url);
6364
return ExecutionStatus.DO_NOT_INVOKE_NEXT_IF_ANY;
6465
} else {

logback-classic/src/test/input/issue/gh_issues_450.xml

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/*
2+
* Logback: the reliable, generic, fast and flexible logging framework.
3+
* Copyright (C) 1999-2025, QOS.ch. All rights reserved.
4+
*
5+
* This program and the accompanying materials are dual-licensed under
6+
* either the terms of the Eclipse Public License v1.0 as published by
7+
* the Eclipse Foundation
8+
*
9+
* or (per the licensee's choosing)
10+
*
11+
* under the terms of the GNU Lesser General Public License version 2.1
12+
* as published by the Free Software Foundation.
13+
*/
14+
15+
package ch.qos.logback.classic.issue.github450;
16+
17+
import ch.qos.logback.classic.Level;
18+
import ch.qos.logback.classic.Logger;
19+
import ch.qos.logback.classic.LoggerContext;
20+
import ch.qos.logback.classic.spi.LoggerContextListener;
21+
import ch.qos.logback.core.spi.ContextAwareBase;
22+
import ch.qos.logback.core.spi.LifeCycle;
23+
import org.slf4j.MDC;
24+
25+
public class Issues450LoggerContextListener extends ContextAwareBase implements LoggerContextListener, LifeCycle {
26+
27+
boolean started = false;
28+
29+
@Override
30+
public void start() {
31+
MDC.put("issues450", "12");
32+
started = true;
33+
}
34+
35+
@Override
36+
public void stop() {
37+
started = false;
38+
}
39+
40+
@Override
41+
public boolean isStarted() {
42+
return started;
43+
}
44+
45+
@Override
46+
public boolean isResetResistant() {
47+
return false;
48+
}
49+
50+
@Override
51+
public void onStart(LoggerContext context) {
52+
53+
}
54+
55+
@Override
56+
public void onReset(LoggerContext context) {
57+
58+
}
59+
60+
@Override
61+
public void onStop(LoggerContext context) {
62+
63+
}
64+
65+
@Override
66+
public void onLevelChange(Logger logger, Level level) {
67+
}
68+
69+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Logback: the reliable, generic, fast and flexible logging framework.
3+
* Copyright (C) 1999-2025, QOS.ch. All rights reserved.
4+
*
5+
* This program and the accompanying materials are dual-licensed under
6+
* either the terms of the Eclipse Public License v1.0 as published by
7+
* the Eclipse Foundation
8+
*
9+
* or (per the licensee's choosing)
10+
*
11+
* under the terms of the GNU Lesser General Public License version 2.1
12+
* as published by the Free Software Foundation.
13+
*/
14+
15+
package ch.qos.logback.classic.issue.github450;
16+
17+
import ch.qos.logback.classic.ClassicConstants;
18+
import ch.qos.logback.classic.ClassicTestConstants;
19+
import ch.qos.logback.classic.spi.ILoggingEvent;
20+
import ch.qos.logback.classic.spi.LoggingEvent;
21+
import ch.qos.logback.core.CoreConstants;
22+
import ch.qos.logback.core.read.ListAppender;
23+
import org.slf4j.Logger;
24+
import org.slf4j.LoggerFactory;
25+
import org.slf4j.MDC;
26+
27+
public class Main {
28+
29+
public static void main(String[] args) {
30+
System.setProperty(ClassicConstants.CONFIG_FILE_PROPERTY, "logback-classic/"+ClassicTestConstants.INPUT_PREFIX + "issue/gh_issues_450.xml");
31+
System.setProperty(CoreConstants.STATUS_LISTENER_CLASS_KEY, "stdout");
32+
Logger logger = LoggerFactory.getLogger(Main.class);
33+
logger.info("toto");
34+
ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
35+
36+
ListAppender listAppender = (ListAppender) root.getAppender("LIST");
37+
38+
LoggingEvent le0 = (LoggingEvent) listAppender.list.get(0);
39+
40+
String val = le0.getMDCPropertyMap().get("issues450");
41+
if(val == null) {
42+
throw new RuntimeException("issues450 missing property: issues450");
43+
}
44+
}
45+
}

0 commit comments

Comments
 (0)