Created
July 19, 2013 13:59
-
-
Save voituk/6039301 to your computer and use it in GitHub Desktop.
android.getLogcat.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static String getLogcat() { | |
BufferedReader br = null; | |
try { | |
Process process = Runtime.getRuntime().exec( new String[] { | |
"logcat", "-d" //, "-v", "time", "-s", "*:W" | |
}); | |
br = new BufferedReader( new InputStreamReader(process.getInputStream()), 8*1024); | |
String line; | |
StringBuilder log = new StringBuilder(); | |
while ( (line = br.readLine()) != null) { | |
log.append(line).append("\n"); | |
} | |
return log.toString(); | |
} catch ( Exception e) { | |
return null; | |
} finally { | |
close(br); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment