try {
if( event.isPropertyChanged() ) {
ConfigContext newConfig = event.getConfigContext();
Iterator iter = event.getConfigChangeList().iterator();
while (iter.hasNext() ) {
Object change= iter.next();
if (change instanceof ConfigAdd || change instanceof ConfigUpdate) {
String xpath = ((ConfigChange)change).getXPath();
if( xpath != null){
ConfigBean item = newConfig.exactLookup(xpath);
if (item instanceof ElementProperty) {
ElementProperty elementProperty = (ElementProperty)item;
String loggerName = elementProperty.getName();
String logLevel = elementProperty.getValue();
boolean logExists = LogMBean.getInstance().findLogger(loggerName);
if (!logExists) {
Logger.getLogger(loggerName); //if the logger doesn't exist, create it.
}
LogMBean.getInstance().setLogLevel( loggerName, logLevel );
}
}
}
}
} else {
// This is not a property change event, so it must be a
// module log level change.
LogMBean.getInstance().setLogLevelForModule(
event.getModuleName(), event.getNewLogLevel() );
}
} catch( Exception e ) {
new ErrorManager().error( "Error In LogLevelChanged event", e,
ErrorManager.GENERIC_FAILURE );
}