logback-android/src/main/java/ch/qos/logback/classic/Level.java
public static Level toLevel(final String sArg, Level defaultLevel) {
    if (sArg == null) {
      return defaultLevel;
    }

    final String in = sArg.trim();

    if (in.equalsIgnoreCase("ALL")) {
      return Level.ALL;
    }
    if (in.equalsIgnoreCase("TRACE")) {
      return Level.TRACE;
    }
    if (in.equalsIgnoreCase("DEBUG")) {
      return Level.DEBUG;
    }
    if (in.equalsIgnoreCase("INFO")) {
      return Level.INFO;
    }
    if (in.equalsIgnoreCase("WARN")) {
      return Level.WARN;
    }
    if (in.equalsIgnoreCase("ERROR")) {
      return Level.ERROR;
    }
    if (in.equalsIgnoreCase("OFF")) {
      return Level.OFF;
    }
    return defaultLevel;
  }
public static Level toLevel(final String sArg, Level defaultLevel) {
    if (sArg == null) {
      return defaultLevel;
    }

    final String in = sArg.trim();

    if (in.equalsIgnoreCase("ALL")) {
      return Level.ALL;
    }
    if (in.equalsIgnoreCase("TRACE")) {
      return Level.TRACE;
    }
    if (in.equalsIgnoreCase("DEBUG")) {
      return Level.DEBUG;
    }
    if (in.equalsIgnoreCase("INFO")) {
      return Level.INFO;
    }
    if (in.equalsIgnoreCase("WARN")) {
      return Level.WARN;
    }
    if (in.equalsIgnoreCase("ERROR")) {
      return Level.ERROR;
    }
    if (in.equalsIgnoreCase("OFF")) {
      return Level.OFF;
    }
    return defaultLevel;
  }
Convert the string passed as argument to a Level. If the conversion fails,
then this method returns the value of <code>defaultLevel</code>.
@param sArg string to be evaluated
@param defaultLevel default level if sArg could not be converted
@return the corresponding level