Package org.silverpeas.kernel.logging
Class SilverLoggerProvider
java.lang.Object
org.silverpeas.kernel.logging.SilverLoggerProvider
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
SilverLoggerProvideris lazily spawn: it is created at the first invocation of thegetInstance()static method.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe namespace of the root logger in Silverpeas. -
Method Summary
Modifier and TypeMethodDescriptionGets theLoggerConfigurationManagerinstance used by this provider to manage the configuration of the Silverpeas loggers.static SilverLoggerProviderGets the single instance of this provider ofSilverLoggerobjects.Gets a logger for the specified object.Gets the logger that is defined for the specified logging namespace.
-
Field Details
-
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
Gets the single instance of this provider ofSilverLoggerobjects.- Returns:
- a
SilverLoggerProviderinstance.
-
getLogger
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 theSilverLoggerFactoryfactory. 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
SilverLoggerFactoryinstance.
-
getLogger
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
silverpeassubpackage: for a packageorg.silverpeas.core.io, there is a logger with the namespacesilverpeas.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
SilverLoggerFactoryinstance. - See Also:
-
getConfigurationManager
Gets theLoggerConfigurationManagerinstance used by this provider to manage the configuration of the Silverpeas loggers. By using theLoggerConfigurationManagerobject, you can modify programmatically the configuration of a logger.- Returns:
- the
LoggerConfigurationManagerinstance backed by this Silverpeas loggers provider.
-