Skip to content

Commit 31bfc1d

Browse files
committed
Differentiate internal LogAdapter from core.log.LogDelegateFactory
Issue: SPR-16585 Issue: SPR-17012
1 parent d3b244a commit 31bfc1d

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

spring-jcl/src/main/java/org/apache/commons/logging/LogDelegate.java spring-jcl/src/main/java/org/apache/commons/logging/LogAdapter.java

+14-14
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,18 @@
2828
import org.slf4j.spi.LocationAwareLogger;
2929

3030
/**
31-
* Spring's common JCL delegate behind {@link LogFactory} and {@link LogFactoryService}.
31+
* Spring's common JCL adapter behind {@link LogFactory} and {@link LogFactoryService}.
3232
* Detects the presence of Log4j 2.x / SLF4J, falling back to {@code java.util.logging}.
3333
*
3434
* @author Juergen Hoeller
3535
* @since 5.1
3636
*/
37-
final class LogDelegate {
37+
final class LogAdapter {
3838

3939
private static LogApi logApi = LogApi.JUL;
4040

4141
static {
42-
ClassLoader cl = LogDelegate.class.getClassLoader();
42+
ClassLoader cl = LogAdapter.class.getClassLoader();
4343
try {
4444
// Try Log4j 2.x API
4545
cl.loadClass("org.apache.logging.log4j.spi.ExtendedLogger");
@@ -65,7 +65,7 @@ final class LogDelegate {
6565
}
6666

6767

68-
private LogDelegate() {
68+
private LogAdapter() {
6969
}
7070

7171

@@ -76,35 +76,35 @@ private LogDelegate() {
7676
public static Log createLog(String name) {
7777
switch (logApi) {
7878
case LOG4J:
79-
return Log4jDelegate.createLog(name);
79+
return Log4jAdapter.createLog(name);
8080
case SLF4J_LAL:
81-
return Slf4jDelegate.createLocationAwareLog(name);
81+
return Slf4jAdapter.createLocationAwareLog(name);
8282
case SLF4J:
83-
return Slf4jDelegate.createLog(name);
83+
return Slf4jAdapter.createLog(name);
8484
default:
85-
// Defensively use lazy-initializing delegate class here as well since the
85+
// Defensively use lazy-initializing adapter class here as well since the
8686
// java.logging module is not present by default on JDK 9. We are requiring
8787
// its presence if neither Log4j nor SLF4J is available; however, in the
8888
// case of Log4j or SLF4J, we are trying to prevent early initialization
8989
// of the JavaUtilLog adapter - e.g. by a JVM in debug mode - when eagerly
9090
// trying to parse the bytecode for all the cases of this switch clause.
91-
return JavaUtilDelegate.createLog(name);
91+
return JavaUtilAdapter.createLog(name);
9292
}
9393
}
9494

9595

9696
private enum LogApi {LOG4J, SLF4J_LAL, SLF4J, JUL}
9797

9898

99-
private static class Log4jDelegate {
99+
private static class Log4jAdapter {
100100

101101
public static Log createLog(String name) {
102102
return new Log4jLog(name);
103103
}
104104
}
105105

106106

107-
private static class Slf4jDelegate {
107+
private static class Slf4jAdapter {
108108

109109
public static Log createLocationAwareLog(String name) {
110110
Logger logger = LoggerFactory.getLogger(name);
@@ -118,7 +118,7 @@ public static Log createLog(String name) {
118118
}
119119

120120

121-
private static class JavaUtilDelegate {
121+
private static class JavaUtilAdapter {
122122

123123
public static Log createLog(String name) {
124124
return new JavaUtilLog(name);
@@ -353,7 +353,7 @@ public void trace(Object message, Throwable exception) {
353353
}
354354

355355
protected Object readResolve() {
356-
return Slf4jDelegate.createLog(this.name);
356+
return Slf4jAdapter.createLog(this.name);
357357
}
358358
}
359359

@@ -449,7 +449,7 @@ public void trace(Object message, Throwable exception) {
449449

450450
@Override
451451
protected Object readResolve() {
452-
return Slf4jDelegate.createLocationAwareLog(this.name);
452+
return Slf4jAdapter.createLocationAwareLog(this.name);
453453
}
454454
}
455455

spring-jcl/src/main/java/org/apache/commons/logging/LogFactory.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public static Log getLog(Class<?> clazz) {
6464
* @param name logical name of the <code>Log</code> instance to be returned
6565
*/
6666
public static Log getLog(String name) {
67-
return LogDelegate.createLog(name);
67+
return LogAdapter.createLog(name);
6868
}
6969

7070

spring-jcl/src/main/java/org/apache/commons/logging/LogFactoryService.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public Log getInstance(Class<?> clazz) {
3737

3838
@Override
3939
public Log getInstance(String name) {
40-
return LogDelegate.createLog(name);
40+
return LogAdapter.createLog(name);
4141
}
4242

4343

0 commit comments

Comments
 (0)