获取logcat信息

static final int BUFFER_SIZE = 1024;

public String getLogCat() {
String[] logcatArgs = new String[] {"logcat", "-v", "time"};

Process logcatProc = null;
try {
    logcatProc = Runtime.getRuntime().exec(logcatArgs);
}
catch (IOException e) {
    return null;
}

BufferedReader reader = null;
String response = null;
try {
    String separator = System.getProperty("line.separator");
    StringBuilder sb = new StringBuilder();
    reader = new BufferedReader(new InputStreamReader(logcatProc.getInputStream()), BUFFER_SIZE);
    String line;
    while ((line = reader.readLine()) != null) {
        sb.append(line);
        sb.append(separator);
    }
    response = sb.toString();
}
catch (IOException e) {
}
finally {
    if (reader != null) {
        try {
            reader.close();
        }
        catch (IOException e) {}
    }
}

return response;
}