Class SilverLoggerProvider

java.lang.Object
org.silverpeas.kernel.logging.SilverLoggerProvider

public class SilverLoggerProvider extends Object
A provider of a SilverLogger. It is a singleton and its single instance is lazily created. It is used by the SilverLogger class to get a SilverLogger instance matching a given logging namespace.
Author:
mmoquillon
Implementation Note:
the single instance of SilverLoggerProvider is lazily spawn: it is created at the first invocation of the getInstance() static method.
  • Field Details

    • ROOT_NAMESPACE

      public static final String ROOT_NAMESPACE
      The namespace of the root logger in Silverpeas. This namespace is predefined and each logger taken in charge by the Logging Engine should be a descendant of its logger.
      See Also:
  • Method Details

    • getInstance

      public static SilverLoggerProvider getInstance()
      Gets the single instance of this provider of SilverLogger objects.
      Returns:
      a SilverLoggerProvider instance.
    • getLogger

      public SilverLogger getLogger(String module)
      Gets the logger that is defined for the specified logging namespace.

      A logging namespace is the name or a category under which the messages will be log. The messages will be logged only if the logging level satisfies the logger's level. If no level is set for the logger, then the level from its nearest ancestor with a specific (non-null) level value is taken into account.

      The logger instance is obtained from the logging namespace by using the SilverLoggerFactory factory. The factory has also the responsibility of the initialization mechanism of the logger from its logging configuration parameters before returning it.
      Parameters:
      module - a logging namespace.
      Returns:
      a logger instance identified by the given logging namespace, manufactured by a SilverLoggerFactory instance.
    • getLogger

      public SilverLogger getLogger(Object object)
      Gets a logger for the specified object. The logger is found from the package name of the specified object.

      In Silverpeas, each logger namespace matches a package name, starting from the silverpeas subpackage: for a package org.silverpeas.core.io, there is a logger with the namespace silverpeas.core.io.

      Parameters:
      object - the object from which the logger namespace will be determined.
      Returns:
      a logger instance identified by the logging namespace that was determined from the given object, manufactured by a SilverLoggerFactory instance.
      See Also:
    • getConfigurationManager

      public LoggerConfigurationManager getConfigurationManager()
      Gets the LoggerConfigurationManager instance used by this provider to manage the configuration of the Silverpeas loggers. By using the LoggerConfigurationManager object, you can modify programmatically the configuration of a logger.
      Returns:
      the LoggerConfigurationManager instance backed by this Silverpeas loggers provider.