Package org.geotools.util.logging
Class LogbackLoggerFactory
Object
LoggerFactory<Logger>
LogbackLoggerFactory
A factory for loggers that redirect all Java logging events to logback framework (using the
<AHREF="https://www.slf4j.org/">sl4j API).
The sl4j api is used to all interactions excepting LogbackLogger.setLevel(Level) (which is primarily used
during test cases).
- Since:
- 27
- Author:
- Jody Garnett (GeoCat)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected LoggergetImplementation(String name) Returns the implementation to use for the logger of the specified name, ornullif the logger would delegate to Java logging anyway.static LogbackLoggerFactoryReturns the unique instance of this factory.Look up configuration information, ornullunknown.protected LoggerReturns the implementation wrapped by the specified logger, ornullif none.protected LogbackLoggerWraps the specified implementation in a Java logger.Methods inherited from class LoggerFactory
getImplementationClass, getLogger
-
Constructor Details
-
LogbackLoggerFactory
Constructs a default factory.- Throws:
NoClassDefFoundError- if sl4j'sorg.slf4j.Loggerclass was not found on the classpath.
-
-
Method Details
-
getInstance
Returns the unique instance of this factory.- Throws:
NoClassDefFoundError- if sl4j'sorg.slf4j.Loggerclass was not found on the classpath.
-
getImplementation
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<Logger>- 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
Wraps the specified implementation in a Java logger.- Specified by:
wrapin classLoggerFactory<Logger>- 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
Returns the implementation wrapped by the specified logger, ornullif none.- Specified by:
unwrapin classLoggerFactory<Logger>- Parameters:
logger- The logger to test.- Returns:
- The implementation wrapped by the specified logger, or
nullif none.
-
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<Logger>- Returns:
- configuration information, or
nullunknown.
-