Try the following code to get only the logs of your application.
public final class MyAppLogReader { private static final String TAG = MyAppLogReader.class.getCanonicalName(); private static final String processId = Integer.toString(android.os.Process .myPid()); public static StringBuilder getLog() { StringBuilder builder = new StringBuilder(); try { String[] command = new String[] { "logcat", "-d", "-v", "threadtime" }; Process process = Runtime.getRuntime().exec(command); BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(process.getInputStream())); String line; while ((line = bufferedReader.readLine()) != null) { if (line.contains(processId)) { builder.append(line);
Edit
Add permission below to your AndroidManifest file
<uses-permission android:name="android.permission.READ_LOGS" />
source share