Skip to content

Commit f661917

Browse files
authored
Merge pull request #216 from kovaceviccz/upgrade-slf4j-to-2.x
Upgrade SLF4J to 2.x
2 parents 4da06d2 + 353c1e6 commit f661917

File tree

8 files changed

+77
-56
lines changed

8 files changed

+77
-56
lines changed

legal-notices/THIRDPARTYREADME.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -951,11 +951,11 @@ Copyright: Copyright 2008 Sebo Zoltan <iamzoli@yahoo.com>
951951
Version: isorelax-20030108.jar
952952
Copyright: Copyright 2001 Kohsuke KAWAGUCHI
953953

954-
Version: slf4j-api-1.7.5.jar
955-
Copyright: Copyright 2004-2013 QOS.ch
954+
Version: slf4j-api-2.0.17.jar
955+
Copyright: Copyright 2004-2025 QOS.ch
956956

957-
Version: slf4j-nop-1.7.5.jar
958-
Copyright: Copyright 2004-2013 QOS.ch
957+
Version: slf4j-nop-2.0.17.jar
958+
Copyright: Copyright 2004-2025 QOS.ch
959959

960960
Version: slf4j-jdk14-1.7.5.jar
961961
Copyright: Copyright 2004-2007 QOS.ch

openam-server-only/src/main/webapp/WEB-INF/weblogic.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
~ information: "Portions copyright [year] [name of copyright owner]".
1414
~
1515
~ Copyright 2015-2016 ForgeRock AS.
16+
~ Portions copyright 2025 Wren Security.
1617
-->
1718
<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app"
1819
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -39,7 +40,7 @@
3940
<package-name>org.slf4j.bridge.*</package-name>
4041
</prefer-application-packages>
4142
<prefer-application-resources>
42-
<resource-name>org/slf4j/impl/StaticLoggerBinder.class</resource-name>
43+
<resource-name>META-INF/services/org.slf4j.spi.SLF4JServiceProvider</resource-name>
4344
</prefer-application-resources>
4445
</container-descriptor>
45-
</weblogic-web-app>
46+
</weblogic-web-app>

openam-slf4j/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<dependency>
3333
<groupId>org.slf4j</groupId>
3434
<artifactId>slf4j-api</artifactId>
35-
<version>1.7.2</version>
35+
<version>2.0.17</version>
3636
</dependency>
3737

3838
<dependency>

openam-slf4j/src/main/java/org/forgerock/openam/slf4j/AMDebugLogger.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
* information: "Portions Copyrighted [year] [name of copyright owner]".
1313
*
1414
* Copyright 2014-2016 ForgeRock AS.
15+
* Portions Copyrighted 2025 Wren Security.
1516
*/
1617

1718
package org.forgerock.openam.slf4j;
@@ -29,6 +30,7 @@ public class AMDebugLogger extends MarkerIgnoringBase {
2930

3031
public AMDebugLogger(Debug debug) {
3132
this.debug = debug;
33+
this.name = debug.getName();
3234
}
3335

3436
public boolean isTraceEnabled() {
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*
2+
* The contents of this file are subject to the terms of the Common Development and
3+
* Distribution License (the License). You may not use this file except in compliance with the
4+
* License.
5+
*
6+
* You can obtain a copy of the License at legal/CDDLv1.1.txt. See the License for the
7+
* specific language governing permission and limitations under the License.
8+
*
9+
* When distributing Covered Software, include this CDDL Header Notice in each file and include
10+
* the License file at legal/CDDLv1.1.txt. If applicable, add the following below the CDDL
11+
* Header, with the fields enclosed by brackets [] replaced by your own identifying
12+
* information: "Portions copyright [year] [name of copyright owner]".
13+
*
14+
* Copyright 2025 Wren Security. All rights reserved.
15+
*/
16+
package org.forgerock.openam.slf4j;
17+
18+
import org.slf4j.ILoggerFactory;
19+
import org.slf4j.IMarkerFactory;
20+
import org.slf4j.helpers.BasicMarkerFactory;
21+
import org.slf4j.helpers.NOPMDCAdapter;
22+
import org.slf4j.spi.MDCAdapter;
23+
import org.slf4j.spi.SLF4JServiceProvider;
24+
25+
/**
26+
* SLF4J service provider implementation which registers {@link AMLoggerFactory} as the logger factory.
27+
*/
28+
public class AMSlf4jServiceProvider implements SLF4JServiceProvider {
29+
30+
/**
31+
* Version of the SLF4J API this implementation is compiled against.
32+
*/
33+
public static String REQUESTED_API_VERSION = "2.0.17";
34+
35+
private final IMarkerFactory markerFactory = new BasicMarkerFactory();
36+
37+
private final MDCAdapter mdcAdapter = new NOPMDCAdapter();
38+
39+
private ILoggerFactory loggerFactory;
40+
41+
@Override
42+
public ILoggerFactory getLoggerFactory() {
43+
return loggerFactory;
44+
}
45+
46+
@Override
47+
public IMarkerFactory getMarkerFactory() {
48+
return markerFactory;
49+
}
50+
51+
@Override
52+
public MDCAdapter getMDCAdapter() {
53+
return mdcAdapter;
54+
}
55+
56+
@Override
57+
public String getRequestedApiVersion() {
58+
return REQUESTED_API_VERSION;
59+
}
60+
61+
@Override
62+
public void initialize() {
63+
loggerFactory = new AMLoggerFactory();
64+
}
65+
}

openam-slf4j/src/main/java/org/slf4j/impl/StaticLoggerBinder.java

Lines changed: 0 additions & 48 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
org.forgerock.openam.slf4j.AMSlf4jServiceProvider

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@
183183
<java-ipv6.version>0.17</java-ipv6.version>
184184
<javassist.version>3.29.1-GA</javassist.version>
185185
<restlet.version>2.6.0</restlet.version>
186-
<slf4j.version>1.7.36</slf4j.version>
186+
<slf4j.version>2.0.17</slf4j.version>
187187
<snakeyaml.version>2.2</snakeyaml.version>
188188

189189
<!-- WS / RS Related Dependencies -->

0 commit comments

Comments
 (0)