Interface SilverLoggerFactory
- All Known Implementing Classes:
SysLoggerFactory
The factory isn't dedicated to be used by client code but by the
SilverLogger class to obtain an instance of a logger
according to the actual active logging backend. By implementing this interface, the implementor
has the total control of any cache mechanism as well as of the loggers manufacture process.
The bind between the SilverLoggerFactory interface and its
implementation is performed by the Java SPI (Java Service Provider Interface). Only the first
available logger factory implementation is loaded. If no implementation candidate is found
through the Java SPI, then a default implementation, that uses the standard Java Logging
mechanism, is loaded.
- Author:
- mmoquillon
-
Method Summary
Modifier and TypeMethodDescriptionstatic SilverLoggerFactoryGets an instance of the logger factory.default SilverLoggerGets aSilverLoggerinstance for the specified namespace.getLogger(String namespace, LoggerConfigurationManager.LoggerConfiguration configuration) Gets aSilverLoggerinstance for the specified namespace.
-
Method Details
-
getInstance
Gets an instance of the logger factory. The implementation is provided by the Java Service Provider Interface and this implementation wraps the concrete logging mechanism used by the Silverpeas Logging Engine. If no candidate is found through the Java SPI, then a default implementation is loaded; this default implementation wraps the Java Logging system.- Returns:
- an instance of a logger factory.
-
getLogger
Gets aSilverLoggerinstance for the specified namespace. If a logger has already been created with the given namespace it is returned, otherwise a new logger is manufactured and initialized.The logging level of the returned logger will be set according to the logging configuration found for the given logger namespace. If no level setting is found from the configuration or if there is no configuration found for the specified namespace, then the logger level is set to null meaning it should inherit its level from its nearest ancestor with a specific (non-null) level value. It is the responsibility of the implementation of the logger to take care of the logging level inheritance and of the default log handlers/adapters used by Silverpeas.
This method should not be invoked directly. It is dedicated to be used by the
SilverLogger.getLogger(String)method or by the implementation of the Silverpeas Logging Engine.- Parameters:
namespace- the hierarchical dot-separated namespace of the logger mapping the hierarchical relationships between the loggers from the root one.- Returns:
- a Silverpeas logger instance.
-
getLogger
SilverLogger getLogger(String namespace, LoggerConfigurationManager.LoggerConfiguration configuration) Gets aSilverLoggerinstance for the specified namespace. If a logger has already been created with the given namespace it is returned, otherwise a new logger is manufactured and initialized from the given logger configuration.The logging level of the returned logger will be set according to the specified logging configuration. If no level setting is found from the configuration or if there is no configuration found for the specified namespace, then the logger level is set to null meaning it should inherit its level from its nearest ancestor with a specific (non-null) level value. It is the responsibility of the implementation of the logger to take care of the logging level inheritance and of the default log handlers/adapters used by Silverpeas.
This method should not be invoked directly. It is dedicated to be used by the
SilverLogger.getLogger(String)method or by the implementation of the Silverpeas Logging Engine.- Parameters:
namespace- the hierarchical dot-separated namespace of the logger mapping the hierarchical relationships between the loggers from the root one.configuration- the logger configuration to use when initializing the manufactured logger. If the logger already exists, the configuration won't be used in order to avoid any replacement of the existing configuration. To update its configuration, please use insteadLoggerConfigurationManager.- Returns:
- a Silverpeas logger instance.
-