Level logLevel = null;
try {
Config cfg =
ServerBeansFactory.getConfigBean(sc.getConfigContext());
ModuleLogLevels allModulesLogLevels =
cfg.getLogService().getModuleLogLevels( );
// _REVISIT_: Right now ModuleLogLevels element in Log-Service
// is optional. If the user doesn't specify any module log levels
// then we will use 'INFO' as the default. For 8.1 this should
// be a required element.
if( allModulesLogLevels == null ) { return Level.INFO; }
if( allModulesLogLevels.getRoot( ).equals( "OFF" ) ) {
return Level.OFF;
}
// _REVISIT_: This is a bad way of searching for a loggername match
// clean this up after Technology Preview
ElementProperty[] elementProperties =
cfg.getLogService().getModuleLogLevels().getElementProperty( );
if( elementProperties != null ) {
for( int i = 0; i < elementProperties.length; i++ ) {
if( elementProperties[i].getName().equals(loggerName) ) {
return Level.parse( elementProperties[i].getValue());
}
}
}
String logModName = ModuleToLoggerNameMapper.getModuleName(loggerName);
if (logModName!=null) {
try {
String val = allModulesLogLevels.getAttributeValue(logModName);
logLevel = Level.parse(val);
} catch (Exception noSuch) { //no such module name,such as "core", in <module-log-levels>
}
}
} catch ( Exception e ) {