Skip to content

Commit 45e7b35

Browse files
committed
LogFactory provides getFactory() with getInstance methods as well
Issue: SPR-14512
1 parent 47277f4 commit 45e7b35

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

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

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,40 @@ public static Log getLog(String name) {
9898
}
9999
}
100100

101+
/**
102+
* This method only exists for compatibility with unusual Commons Logging API
103+
* usage like e.g. {@code LogFactory.getFactory().getInstance(Class/String)}.
104+
* @see #getInstance(Class)
105+
* @see #getInstance(String)
106+
* @deprecated in favor of {@link #getLog(Class)}/{@link #getLog(String)}
107+
*/
108+
@Deprecated
109+
public static LogFactory getFactory() {
110+
return new LogFactory() {};
111+
}
112+
113+
/**
114+
* Convenience method to return a named logger.
115+
* <p>This variant just dispatches straight to {@link #getLog(Class)}.
116+
* @param clazz containing Class from which a log name will be derived
117+
* @deprecated in favor of {@link #getLog(Class)}
118+
*/
119+
@Deprecated
120+
public Log getInstance(Class<?> clazz) {
121+
return getLog(clazz);
122+
}
123+
124+
/**
125+
* Convenience method to return a named logger.
126+
* <p>This variant just dispatches straight to {@link #getLog(String)}.
127+
* @param name logical name of the <code>Log</code> instance to be returned
128+
* @deprecated in favor of {@link #getLog(String)}
129+
*/
130+
@Deprecated
131+
public Log getInstance(String name) {
132+
return getLog(name);
133+
}
134+
101135

102136
private enum LogApi {LOG4J, SLF4J, JUL}
103137

0 commit comments

Comments
 (0)