public static String readLog() {
    StringBuffer sb = new StringBuffer();

    try {
      filename = (filename == null) ? "application.log" : filename;
      File logFile = new File("/sdcard/" + filename);
      if (!logFile.exists())
        return "LogFile does not exist. It must be enabled in the FrameworkDefaults.ENABLE_FILELOGGING = true";

      FileReader f = new FileReader(logFile);
      BufferedReader in = new BufferedReader(f);

      Boolean end = false;

      while (!end) {
        String s = in.readLine();
        if (s == null) {
          end = true;
        } else {
          sb.append(s);
          sb.append("\n");
        }
      }
      in.close();
    } catch (Exception ex) {
      Logger.e(LOGNAME, "Could not read file " + ex.getMessage());
    }

    return sb.toString();
  }
  protected String getTextFromNode(String xml, String tag) {
    String startTag = "<" + tag + ">";
    String endTag = "</" + tag + ">";

    String response = null;

    try {
      response = xml.substring(xml.indexOf(startTag) + startTag.length(), xml.indexOf(endTag));
    } catch (StringIndexOutOfBoundsException se) {
      Logger.e(LOGNAME, "Parser:Invalid XML Tag:" + tag);
    }

    return response;
  }
  public static void writeToHttpLog(String message) {
    try {

      File gpxfile = new File("/sdcard/framework-http.log");
      if (!gpxfile.exists()) gpxfile.createNewFile();

      FileWriter gpxwriter = new FileWriter(gpxfile, true);
      PrintWriter out = new PrintWriter(gpxwriter);
      out.println(message);
      out.close();

    } catch (IOException e) {
      Logger.e(LOGNAME, "Could not write file " + e.getMessage());
    }
  }