Class LoggerConfigurationManager


  • @Technical
    @Bean
    @Singleton
    public class LoggerConfigurationManager
    extends Object
    There is a single global LoggerConfigurationManager object that is used to manage a set of configuration about the different Loggers available in Silverpeas.

    Each logger in Silverpeas is usually mapped to a given Silverpeas module. A Silverpeas module is either a component of Silverpeas Core or an application in Silverpeas Components. By defining a mapping between a module and a logger, when logging some messages, it is required to the objects just to pass the name of the module to which they belong; 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 with optionally 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 SILVERPEAS_HOME/properties/org/silverpeas/util/logging directory.

    Author:
    miguel
    • Constructor Detail

      • LoggerConfigurationManager

        protected LoggerConfigurationManager()
    • Method Detail

      • loadAllConfigurationFiles

        @PostConstruct
        protected void loadAllConfigurationFiles()
      • getLoggerConfiguration

        public LoggerConfigurationManager.LoggerConfiguration getLoggerConfiguration​(String namespace)
        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

        public void saveLoggerConfiguration​(LoggerConfigurationManager.LoggerConfiguration configuration)
        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

        public Set<LoggerConfigurationManager.LoggerConfiguration> getAvailableLoggerConfigurations()
        Gets the available configuration of all the Silverpeas loggers. If a logger has no configuration file, then it is'nt taken into account.
        Returns:
        a set of logger configurations sorted by logger namespace.