if (loggerCollection != null) {
String[] loggerResourcePaths = loggerCollection.getChildren();
for (String loggerResourcePath : loggerResourcePaths) {
String loggerName = loggerResourcePath.substring(LoggingConstants.LOGGERS.length());
Logger logger = LogManager.getLogger(loggerName);
Resource loggerResource = registryManager.getLogger(loggerName);
if (loggerResource != null && logger != null) {
logger.setLevel(Level.toLevel(loggerResource
.getProperty(LoggingConstants.LoggerProperties.LOG_LEVEL)));
logger.setAdditivity(Boolean.parseBoolean(loggerResource
.getProperty(LoggingConstants.LoggerProperties.ADDITIVITY)));
}
}
}
// update the appender data according to data stored in database
Collection appenderCollection = registryManager.getAppenders();
if (appenderCollection != null) {
String[] appenderResourcePaths = appenderCollection.getChildren();
for (String appenderResourcePath : appenderResourcePaths) {
String appenderName = appenderResourcePath.substring(LoggingConstants.APPENDERS
.length());
Appender appender = getAppenderFromSet(appenderSet, appenderName);
Resource appenderResource = registryManager.getAppender(appenderName);
if (appenderResource != null && appender != null) {
if ((appender.getLayout() != null)
&& (appender.getLayout() instanceof PatternLayout)) {
((PatternLayout) appender.getLayout())
.setConversionPattern(appenderResource
.getProperty(LoggingConstants.AppenderProperties.PATTERN));
}
if (appender instanceof FileAppender) {
FileAppender fileAppender = ((FileAppender) appender);
fileAppender.setFile(appenderResource
.getProperty(LoggingConstants.AppenderProperties.LOG_FILE_NAME));
fileAppender.activateOptions();
}
if (appender instanceof MemoryAppender) {
MemoryAppender memoryAppender = (MemoryAppender) appender;
memoryAppender.setCircularBuffer(new CircularBuffer(200));
memoryAppender.activateOptions();
}
if (appender instanceof SyslogAppender) {
SyslogAppender syslogAppender = (SyslogAppender) appender;
syslogAppender.setSyslogHost(appenderResource
.getProperty(LoggingConstants.AppenderProperties.SYS_LOG_HOST));
syslogAppender.setFacility(appenderResource
.getProperty(LoggingConstants.AppenderProperties.FACILITY));
}
if (appender instanceof AppenderSkeleton) {
AppenderSkeleton appenderSkeleton = (AppenderSkeleton) appender;
appenderSkeleton.setThreshold(Level.toLevel(appenderResource
.getProperty(LoggingConstants.AppenderProperties.THRESHOLD)));
appenderSkeleton.activateOptions();
}
}
}