LogFactory provides getFactory() with getInstance methods as well

Issue: SPR-14512
This commit is contained in:
Juergen Hoeller 2017-04-05 22:24:09 +02:00
parent 47277f43da
commit 45e7b350bd
1 changed files with 34 additions and 0 deletions

View File

@ -98,6 +98,40 @@ public abstract class LogFactory {
}
}
/**
* This method only exists for compatibility with unusual Commons Logging API
* usage like e.g. {@code LogFactory.getFactory().getInstance(Class/String)}.
* @see #getInstance(Class)
* @see #getInstance(String)
* @deprecated in favor of {@link #getLog(Class)}/{@link #getLog(String)}
*/
@Deprecated
public static LogFactory getFactory() {
return new LogFactory() {};
}
/**
* Convenience method to return a named logger.
* <p>This variant just dispatches straight to {@link #getLog(Class)}.
* @param clazz containing Class from which a log name will be derived
* @deprecated in favor of {@link #getLog(Class)}
*/
@Deprecated
public Log getInstance(Class<?> clazz) {
return getLog(clazz);
}
/**
* Convenience method to return a named logger.
* <p>This variant just dispatches straight to {@link #getLog(String)}.
* @param name logical name of the <code>Log</code> instance to be returned
* @deprecated in favor of {@link #getLog(String)}
*/
@Deprecated
public Log getInstance(String name) {
return getLog(name);
}
private enum LogApi {LOG4J, SLF4J, JUL}