protected void parseLevel ( Element element , Logger logger , boolean isRoot ) { String catName = logger . getName ( ) ; if ( isRoot ) { catName = "root" ; } String priStr = subst ( element . getAttribute ( VALUE_ATTR ) ) ; LogLog . debug ( "Level value for " + catName + " is [" + priStr + "]." ) ; if ( INHERITED . equalsIgnoreCase ( priStr ) || NULL . equalsIgnoreCase ( priStr ) ) { if ( isRoot ) { LogLog . error ( "Root level cannot be inherited. Ignoring directive." ) ; } else { logger . setLevel ( null ) ; } } else { String className = subst ( element . getAttribute ( CLASS_ATTR ) ) ; if ( EMPTY_STR . equals ( className ) ) { logger . setLevel ( OptionConverter . toLevel ( priStr , Level . DEBUG ) ) ; } else { LogLog . debug ( "Desired Level sub-class: [" + className + ' ' ) ; try { Class clazz = Loader . loadClass ( className ) ; Method toLevelMethod = clazz . getMethod ( "toLevel" , ONE_STRING_PARAM ) ; Level pri = ( Level ) toLevelMethod . invoke ( null , new Object [ ] { priStr } ) ; logger . setLevel ( pri ) ; } catch ( Exception oops ) { LogLog . error ( "Could not create level [" + priStr + "]. Reported error follows." , oops ) ; return ; } } } LogLog . debug ( catName + " level set to " + logger . getLevel ( ) ) ; }
Used internally to parse a level element .