Package org.silverpeas.core.util.logging
Class SilverLoggerProvider
- java.lang.Object
-
- org.silverpeas.core.util.logging.SilverLoggerProvider
-
@Provider public class SilverLoggerProvider extends Object
A provider of aSilverLogger
. It is managed by the underlying IoD subsystem. It is used by theSilverLogger
class to get aSilverLogger
instance matching a given logging namespace. It can be also directly used in injection points instead of using directly theSilverLogger.getLogger(Object)
orSilverLogger.getLogger(String)
methods. Usually, the later is required for unmanaged beans whereas the foremost can be used by the managed beans.- Author:
- mmoquillon
-
-
Field Summary
Fields Modifier and Type Field Description static String
ROOT_NAMESPACE
The namespace of the root logger in Silverpeas.
-
Constructor Summary
Constructors Modifier Constructor Description protected
SilverLoggerProvider(LoggerConfigurationManager loggerConfigurationManager)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SilverLogger
getLogger(Object object)
Gets a logger for the specified object.SilverLogger
getLogger(String module)
Gets the logger that is defined for the specified logging namespace.protected static SilverLoggerProvider
getLoggerProvider()
Gets an instance of a provider ofSilverLogger
objects.
-
-
-
Field Detail
-
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:
- Constant Field Values
-
-
Constructor Detail
-
SilverLoggerProvider
@Inject protected SilverLoggerProvider(LoggerConfigurationManager loggerConfigurationManager)
-
-
Method Detail
-
getLoggerProvider
protected static SilverLoggerProvider getLoggerProvider()
Gets an instance of a provider ofSilverLogger
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 theSilverLoggerFactory
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 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
SilverLoggerFactory
instance. - See Also:
getLogger(String)
-
-