Class LoggerConfigurationManager
SilverLoggerProvider object.
Each logger in Silverpeas is usually mapped to a given Silverpeas module. A Silverpeas module is a functional component in Silverpeas. The component can provide a service to others components or implement a business service for the end user. By defining a mapping between a module and a logger, when some objects write some messages into a log, only the name of the module in which these objects belong is required to figure out what logger to use; it is hence no necessary to remind the schema of the loggers namespace in use in Silverpeas. Each mapping is defined in a logging configuration file (a Java properties file) with optionally, as property, the logging level to use for the mapped logger.
A logging configuration for a Silverpeas module is stored into a properties file that must be
located in the loggers root directory indicated by
SilverpeasResourcesLocation.getLoggersRootPath(). The following properties are expected
into such a file:
- namespace: the hierarchical path of the logger in which each node is separated by a dot
- level: optional property indicating the level of traces of the logger. If not set, the level is figuring out by coming upward to the nearest parent logger for which a level is defined.
- Author:
- mmoquillon
- API Note:
- It isn't possible to instantiate explicitly this class. To get a
LoggerConfigurationManagerinstance, you should ask to theSilverLoggerProvidersingle instance. - Implementation Note:
- The loading of the loggers configuration isn't done at instantiation; it has to be
invoked explicitly. The instantiation of a
LoggerConfigurationManageris performed by theSilverLoggerProvidersingle instance.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the available configuration of all the Silverpeas loggers.getLoggerConfiguration(String namespace) Gets the configuration parameters for the logger with the specified namespace.protected voidvoidSaves the configuration of the logger referred by the specified configuration instance.
-
Constructor Details
-
LoggerConfigurationManager
protected LoggerConfigurationManager()
-
-
Method Details
-
loadAllConfigurationFiles
protected void loadAllConfigurationFiles() -
getLoggerConfiguration
Gets the configuration parameters for the logger with the specified namespace.- Parameters:
namespace- a logger namespace.- Returns:
- the configuration of the logger defined for the specified namespace.
-
saveLoggerConfiguration
Saves the configuration of the logger referred by the specified configuration instance.If no configuration exists for the logger referred by the configuration object, then nothing is done.
- Parameters:
configuration- the new configuration of the logger defined for the specified Silverpeas module.
-
getAvailableLoggerConfigurations
Gets the available configuration of all the Silverpeas loggers. If a logger has no configuration file, then it isn't taken into account.- Returns:
- a set of logger configurations sorted by logger namespace.
-