public abstract class LoggerFactory<L> extends Object
Logger
wrapping an other logging framework. This factory is used only
when wanting to log to an other framework than Java logging. The getLogger(java.lang.String)
method
returns some subclass of Logger
(typicallly LoggerAdapter
) that forward directly
all log methods to an other framework.Logging
,
LoggerAdapter
Modifier | Constructor and Description |
---|---|
protected |
LoggerFactory(Class<L> loggerClass)
Creates a new factory.
|
Modifier and Type | Method and Description |
---|---|
protected abstract L |
getImplementation(String name)
Returns the implementation to use for the logger of the specified name.
|
Class<L> |
getImplementationClass()
Returns the base class of objects to be returned by
getImplementation(java.lang.String) . |
Logger |
getLogger(String name)
Returns the logger of the specified name, or
null . |
protected abstract L |
unwrap(Logger logger)
Returns the implementation wrapped by the specified logger,
or
null if none. |
protected abstract Logger |
wrap(String name,
L implementation)
Wraps the specified implementation in a Java logger.
|
public Logger getLogger(String name)
null
. If this method has already been
invoked previously with the same name
argument, then it may returns the same logger
provided that:
getImplementation(name)
has not changed.
Logger
instance, or null
if the standard
Java logging framework should be used.name
- The name of the logger.null
.public Class<L> getImplementationClass()
getImplementation(java.lang.String)
. The class
depends on the underlying logging framework (Log4J, SLF4J, etc.).protected abstract L getImplementation(String name)
null
since we should not use wrapper at all.name
- The name of the logger.null
if the target framework would redirect to the Java
logging framework.protected abstract Logger wrap(String name, L implementation)
name
- The name of the logger.implementation
- An implementation returned by getImplementation(java.lang.String)
.protected abstract L unwrap(Logger logger)
null
if none. If the specified logger is not an instance of the expected class,
then this method should returns null
.logger
- The logger to test.null
if none.Copyright © 1996–2019 Geotools. All rights reserved.