code: public static int levelFromString (String level)
      {
          if (level.equalsIgnoreCase("debug")) {
              return DEBUG;
          } else if (level.equalsIgnoreCase("info")) {
              return INFO;
          } else if (level.equalsIgnoreCase("warning")) {
              return WARNING;
          } else {
              return -1;
          }
      }
docs: Returns the log level that matches the specified string or -1 if
  the string could not be interpretted as a log level.