0

I am trying to get the logcat programmatically from my application. There are plenty of tutorials online on how to do this and I am doing it in one of my fragments as such:

Process process = Runtime.getRuntime().exec("logcat -v time -d");
BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(process.getInputStream())); 
StringBuilder log=new StringBuilder();
String line = "";
while ((line = bufferedReader.readLine()) != null) {
     log.append(line);
     log.append("\n");
} 
bufferedReader.close();

This works great; the only problem is that what is returned are only logcat entries from my PID. I would like all logcat entries. I do have READ_LOGS permission. Any ideas what is going on here?

TwinPrimesAreEz
  • 1,699
  • 1
  • 12
  • 16
  • Are you running the APP from the device or from the outside (like from Android Studio)? – Bonatti Aug 04 '15 at 18:18
  • You can find your answer here: http://stackoverflow.com/questions/16795582/not-all-data-shown-when-android-logcat-is-read-programatically – Fratsen Aug 06 '15 at 11:24

0 Answers0