Class LoggerConfigurationManager
- java.lang.Object
-
- org.silverpeas.core.util.logging.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LoggerConfigurationManager.LoggerConfiguration
-
Constructor Summary
Constructors Modifier Constructor Description protected
LoggerConfigurationManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static LoggerConfigurationManager
get()
Set<LoggerConfigurationManager.LoggerConfiguration>
getAvailableLoggerConfigurations()
Gets the available configuration of all the Silverpeas loggers.LoggerConfigurationManager.LoggerConfiguration
getLoggerConfiguration(String namespace)
Gets the configuration parameters for the logger with the specified namespace.protected Map<String,LoggerConfigurationManager.LoggerConfiguration>
getLoggerConfigurations()
protected void
loadAllConfigurationFiles()
void
saveLoggerConfiguration(LoggerConfigurationManager.LoggerConfiguration configuration)
Saves the configuration of the logger referred by the specified configuration instance.
-
-
-
Method Detail
-
getLoggerConfigurations
protected Map<String,LoggerConfigurationManager.LoggerConfiguration> getLoggerConfigurations()
-
loadAllConfigurationFiles
@PostConstruct protected void loadAllConfigurationFiles()
-
get
public static LoggerConfigurationManager get()
-
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.
-
-