Package org.apache.sis.util.logging
Class LoggerFactory<L>
Object
LoggerFactory<L>
- Type Parameters:
L- the type of loggers used for the implementation backend. This is the type used by external frameworks like Log4J.
Deprecated.
Will be removed since there is now other mechanisms for redirecting logging.
See SIS-531.
A factory for Java
Logger wrapping an other logging framework.
This factory is used only when an application wants to redirect SIS logs to an other framework
than JDK logging. An instance of LoggerFactory can be registered to SIS in two ways:
- By declaring the fully qualified classname of the
LoggerFactoryimplementation in theMETA-INF/services/org.apache.sis.util.logging.LoggerFactoryfile. Note that thesis-logging-commons.jarandsis-logging-log4j.jarfiles provide such declaration. - By explicit invocation of
Logging.setLoggerFactory(LoggerFactory)at application initialization time.
getLogger(String) method shall return some Logger subclass
(typically LoggerAdapter) which forwards directly all log methods to the other framework.
Thread safety
This base class is safe for multi-threads usage. Subclasses registered inMETA-INF/services/
shall make sure that any overridden methods remain safe to call from multiple threads.- Since:
- 0.3
- See Also:
Defined in the sis-utility module
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedLoggerFactory(Class<L> loggerClass) Deprecated.Creates a new factory. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract LgetImplementation(String name) Deprecated.Returns the implementation to use for the logger of the specified name.Deprecated.Returns the base class of objects to be returned bygetImplementation(String).getLogger(String name) Deprecated.Returns the logger of the specified name, ornullif the JDK logging framework should be used.abstract StringgetName()Deprecated.Returns the name of the logging framework.protected abstract LDeprecated.Returns the implementation wrapped by the specified logger, ornullif none.protected abstract LoggerDeprecated.Wraps the specified implementation in a JDK logger.
-
Constructor Details
-
LoggerFactory
Deprecated.Creates a new factory.- Parameters:
loggerClass- The class of the wrapped logger.
-
-
Method Details
-
getName
Deprecated.Returns the name of the logging framework.- Returns:
- the logging framework name.
-
getLogger
Deprecated.Returns the logger of the specified name, ornullif the JDK logging framework should be used.- Parameters:
name- the name of the logger.- Returns:
- the logger, or
nullif the JDK logging framework should be used.
-
getImplementationClass
Deprecated.Returns the base class of objects to be returned bygetImplementation(String). The class depends on the underlying logging framework (Log4J, SLF4J, etc.).- Returns:
- the type of loggers used for the implementation backend.
-
getImplementation
Deprecated.Returns the implementation to use for the logger of the specified name. The object to be returned depends on the logging framework (Log4J, SLF4J, etc.). If the target framework redirects logging events to JDK logging, then this method shall returnnullsince we should not use wrapper at all.- 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 JDK logging framework.
-
wrap
Deprecated.Wraps the specified implementation in a JDK logger.- Parameters:
name- the name of the logger.implementation- an implementation returned bygetImplementation(String).- Returns:
- a new logger wrapping the specified implementation.
-
unwrap
Deprecated.Returns the implementation wrapped by the specified logger, ornullif none. If the specified logger is not an instance of the expected class, then this method should returnsnull.- Parameters:
logger- the logger to test.- Returns:
- the implementation wrapped by the specified logger, or
nullif none.
-