Package org.geotools.util.logging
Class CommonsLoggerFactory
- Object
-
- LoggerFactory<Log>
-
- CommonsLoggerFactory
-
public class CommonsLoggerFactory extends LoggerFactory<Log>
A factory for loggers that redirect all Java logging events to the Apache's Commons-logging framework.Out of the box commons logging delegates to the java util logging framework (using the class org.apache.commons.logging.impl.Jdk14Logger). If this factory detects Commons logging is already delegating to Jdk14Logger it will return
nullallowing java util logging directly.- Since:
- 2.4
- Author:
- Martin Desruisseaux
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedCommonsLoggerFactory()Constructs a default factory.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected LoggetImplementation(String name)Returns the implementation to use for the logger of the specified name, ornullif the logger would delegate to Java logging anyway.static CommonsLoggerFactorygetInstance()Returns the unique instance of this factory.StringlookupConfiguration()Look up configuration information, ornullunknown.protected Logunwrap(Logger logger)Returns the implementation wrapped by the specified logger, ornullif none.protected Loggerwrap(String name, Log implementation)Wraps the specified implementation in a Java logger.-
Methods inherited from class LoggerFactory
getImplementationClass, getLogger
-
-
-
-
Constructor Detail
-
CommonsLoggerFactory
protected CommonsLoggerFactory() throws NoClassDefFoundErrorConstructs a default factory.- Throws:
NoClassDefFoundError- if Apache'sLogclass was not found on the classpath.
-
-
Method Detail
-
getInstance
public static CommonsLoggerFactory getInstance() throws NoClassDefFoundError
Returns the unique instance of this factory.- Throws:
NoClassDefFoundError- if Apache'sLogclass was not found on the classpath.
-
getImplementation
protected Log getImplementation(String name)
Returns the implementation to use for the logger of the specified name, ornullif the logger would delegate to Java logging anyway.- Specified by:
getImplementationin classLoggerFactory<Log>- Parameters:
name- The name of the logger.- Returns:
- The logger as an object of the target logging framework (Log4J, SLF4J, etc.), or
nullif the target framework would redirect to the Java logging framework.
-
wrap
protected Logger wrap(String name, Log implementation)
Wraps the specified implementation in a Java logger.- Specified by:
wrapin classLoggerFactory<Log>- Parameters:
name- The name of the logger.implementation- An implementation returned byLoggerFactory.getImplementation(java.lang.String).- Returns:
- A new logger wrapping the specified implementation.
-
unwrap
protected Log unwrap(Logger logger)
Returns the implementation wrapped by the specified logger, ornullif none.- Specified by:
unwrapin classLoggerFactory<Log>- Parameters:
logger- The logger to test.- Returns:
- The implementation wrapped by the specified logger, or
nullif none.
-
lookupConfiguration
public String lookupConfiguration()
Description copied from class:LoggerFactoryLook up configuration information, ornullunknown.Report back details on how logging configuration is setup. Ideally including configuration filename along with any system properties used.
- Overrides:
lookupConfigurationin classLoggerFactory<Log>- Returns:
- configuration information, or
nullunknown.
-
-