Class LogFactory
- Direct Known Subclasses:
- LogFactoryService
LogFactory API,
 providing just the common Log lookup methods. This is inspired
 by the JCL-over-SLF4J bridge and should be source as well as binary
 compatible with all common use of the Commons Logging API (in particular:
 with LogFactory.getLog(Class/String) field initializers).
 This implementation does not support Commons Logging's original provider
 detection. It rather only checks for the presence of the Log4j 2.x API
 and the SLF4J 1.7 API in the Spring Framework classpath, falling back to
 java.util.logging if none of the two is available. In that sense,
 it works as a replacement for the Log4j 2 Commons Logging bridge as well as
 the JCL-over-SLF4J bridge, both of which become irrelevant for Spring-based
 setups as a consequence (with no need for manual excludes of the standard
 Commons Logging API jar anymore either). Furthermore, for simple setups
 without an external logging provider, Spring does not require any extra jar
 on the classpath anymore since this embedded log factory automatically
 delegates to java.util.logging in such a scenario.
 
Note that this Commons Logging variant is only meant to be used for infrastructure logging purposes in the core framework and in extensions. It also serves as a common bridge for third-party libraries using the Commons Logging API, for example, Apache HttpClient, and HtmlUnit, bringing them into the same consistent arrangement without any extra bridge jars.
For logging need in application code, prefer direct use of Log4j 2.x
 or SLF4J or java.util.logging. Simply put Log4j 2.x or Logback
 (or another SLF4J provider) onto your classpath, without any extra bridges,
 and let the framework auto-adapt to your choice.
- Since:
- 5.0
- Author:
- Juergen Hoeller (for the spring-jclvariant)
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionabstract ObjectgetAttribute(String name) Deprecated.abstract String[]Deprecated.static LogFactoryDeprecated.getInstance(Class<?> clazz) Deprecated.in favor ofgetLog(Class)getInstance(String name) Deprecated.in favor ofgetLog(String)static LogConvenience method to return a named logger.static LogConvenience method to return a named logger.static StringDeprecated.abstract voidrelease()Deprecated.static voidrelease(ClassLoader classLoader) Deprecated.static voidDeprecated.abstract voidremoveAttribute(String name) Deprecated.abstract voidsetAttribute(String name, Object value) Deprecated.
- 
Constructor Details- 
LogFactorypublic LogFactory()
 
- 
- 
Method Details- 
getLogConvenience method to return a named logger.- Parameters:
- clazz- containing Class from which a log name will be derived
 
- 
getLogConvenience method to return a named logger.- Parameters:
- name- logical name of the- Loginstance to be returned
 
- 
getFactoryDeprecated.in favor ofgetLog(Class)/getLog(String)This method only exists for compatibility with unusual Commons Logging API usage like, for example,LogFactory.getFactory().getInstance(Class/String).- See Also:
 
- 
getInstanceDeprecated.in favor ofgetLog(Class)Convenience method to return a named logger.This variant just dispatches straight to getLog(Class).- Parameters:
- clazz- containing Class from which a log name will be derived
 
- 
getInstanceDeprecated.in favor ofgetLog(String)Convenience method to return a named logger.This variant just dispatches straight to getLog(String).- Parameters:
- name- logical name of the- Loginstance to be returned
 
- 
getAttributeDeprecated.
- 
getAttributeNamesDeprecated.
- 
removeAttributeDeprecated.
- 
setAttributeDeprecated.
- 
releaseDeprecated.
- 
releaseDeprecated.
- 
releaseAllDeprecated.
- 
objectIdDeprecated.
 
- 
getLog(Class)/getLog(String)