Class SysLoggerFactory

java.lang.Object
org.silverpeas.kernel.logging.sys.SysLoggerFactory
All Implemented Interfaces:
SilverLoggerFactory

@Technical public class SysLoggerFactory extends Object implements SilverLoggerFactory
Implementation of the SilverLoggerFactory interface to provide a logger wrapping the default Java logger.

It manages a cache of SysLogger instances that were already previously asked. If a logger isn't in the cache, then it manufactures it, initializes it from its logging configuration, and puts it into the cache. The loggers are kept for the lifetime of the factory: a logger is initialized only once from its configuration so that any change in its level at runtime isn't lost later.
Author:
mmoquillon
  • Constructor Details

    • SysLoggerFactory

      public SysLoggerFactory()
  • Method Details

    • getLogger

      public SilverLogger getLogger(String namespace, LoggerConfigurationManager.LoggerConfiguration configuration)
      Description copied from interface: SilverLoggerFactory
      Gets a SilverLogger instance 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.

      Specified by:
      getLogger in interface SilverLoggerFactory
      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 instead LoggerConfigurationManager.
      Returns:
      a Silverpeas logger instance.