public static Level toLevel(int val, Level defaultLevel) {
        switch (val) {
        case ALL_INT:
            return ALL;
        case DEBUG_INT:
            return Level.DEBUG;
        case INFO_INT:
            return Level.INFO;
        case WARN_INT:
            return Level.WARN;
        case ERROR_INT:
            return Level.ERROR;
        case FATAL_INT:
            return Level.FATAL;
        case OFF_INT:
            return OFF;
        case TRACE_INT:
            return Level.TRACE;
        default:
            return defaultLevel;
        }
    }
Convert an integer passed as argument to a level. If the conversion fails,
then this method returns the specified default.

@param val a value 
@param defaultLevel a defaultLevel
@return corresponding Level
log4j-over-slf4j/src/main/java/org/apache/log4j/Level.java