Skip to content

Commit 85d6a42

Browse files
committed
Merge branch 'update-slf4j' into update-jdk-11
2 parents 641d34b + 38dc2f7 commit 85d6a42

File tree

7 files changed

+134
-0
lines changed

7 files changed

+134
-0
lines changed

openam-slf4j/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,10 @@
4444
<groupId>org.openidentityplatform.opendj</groupId>
4545
<artifactId>opendj-server-legacy</artifactId>
4646
</dependency>
47+
<dependency>
48+
<groupId>org.testng</groupId>
49+
<artifactId>testng</artifactId>
50+
<scope>test</scope>
51+
</dependency>
4752
</dependencies>
4853
</project>
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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.0.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.0.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 Copyrighted [year] [name of copyright owner]".
13+
*
14+
* Copyright 2025 3A SystemS LLC
15+
*/
16+
17+
package org.forgerock.openam.slf4j;
18+
19+
import org.slf4j.ILoggerFactory;
20+
import org.slf4j.IMarkerFactory;
21+
import org.slf4j.helpers.BasicMarkerFactory;
22+
import org.slf4j.helpers.NOPMDCAdapter;
23+
import org.slf4j.spi.MDCAdapter;
24+
import org.slf4j.spi.SLF4JServiceProvider;
25+
26+
public class OpenAMServiceProvider implements SLF4JServiceProvider {
27+
public static String REQUESTED_API_VERSION = "2.0.99"; // !final
28+
29+
// LoggerFactory expects providers to initialize markerFactory as early as possible.
30+
private final IMarkerFactory markerFactory;
31+
// LoggerFactory expects providers to initialize their MDCAdapter field
32+
// as early as possible, preferably at construction time.
33+
private final MDCAdapter mdcAdapter;
34+
35+
private ILoggerFactory loggerFactory;
36+
37+
public OpenAMServiceProvider() {
38+
markerFactory = new BasicMarkerFactory();
39+
mdcAdapter = new NOPMDCAdapter();
40+
}
41+
42+
@Override
43+
public ILoggerFactory getLoggerFactory() {
44+
return loggerFactory;
45+
}
46+
47+
@Override
48+
public IMarkerFactory getMarkerFactory() {
49+
return markerFactory;
50+
}
51+
52+
@Override
53+
public MDCAdapter getMDCAdapter() {
54+
return mdcAdapter;
55+
}
56+
57+
@Override
58+
public String getRequestedApiVersion() {
59+
return REQUESTED_API_VERSION;
60+
}
61+
62+
@Override
63+
public void initialize() {
64+
loggerFactory = new AMLoggerFactory();
65+
}
66+
}
67+

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

Lines changed: 6 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 ForgeRock AS. All rights reserved.
15+
* Portions Copyrighted 2025 3A Systems LLC
1516
*/
1617

1718
package org.slf4j.impl;
@@ -24,6 +25,11 @@
2425
included as we don't want to update the code when we move to a newer version of slf4j. Not having the version string
2526
means that we might skew with slf4j-api updates. See http://slf4j.org/faq.html, version check mechanism section.
2627
*/
28+
29+
/**
30+
* @deprecated use {@link org.forgerock.openam.slf4j.OpenAMServiceProvider}
31+
*/
32+
@Deprecated
2733
public class StaticLoggerBinder implements LoggerFactoryBinder {
2834
private static final StaticLoggerBinder SINGLETON = new StaticLoggerBinder();
2935
public static final StaticLoggerBinder getSingleton() {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
org.forgerock.openam.slf4j.OpenAMServiceProvider
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package org.forgerock.openam.slf4j;
2+
3+
import org.slf4j.Logger;
4+
import org.slf4j.LoggerFactory;
5+
import org.testng.annotations.Test;
6+
7+
public class TestLogger {
8+
9+
@Test
10+
public void testLogger() {
11+
Logger logger = LoggerFactory.getLogger(TestLogger.class);
12+
logger.info("test");
13+
logger.warn("test2");
14+
logger.error("test3", new Exception("test exception"));
15+
}
16+
17+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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.0.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.0.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 2015 ForgeRock AS.
15+
#
16+
org.forgerock.openam.debug.prefix=
17+
org.forgerock.openam.debug.suffix=-MM.dd.yyyy-HH.mm
18+
org.forgerock.openam.debug.rotation=
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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.0.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.0.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 2015-2016 ForgeRock AS.
15+
#
16+
debugTest1MergeToDebugMerge=debugMerge
17+
debugTest2MergeToDebugMerge=debugMerge
18+
debugTest3MergeToDebugMerge=debugMerge
19+
20+
org.forgerock.test.*=wildcardTest

0 commit comments

Comments
 (0)