Check out Log Collector as an example. Here is the relevant file.
The key is here:
ArrayList<String> commandLine = new ArrayList<String>();
commandLine.add("logcat");//$NON-NLS-1$
[...]
Process process = Runtime.getRuntime().exec(commandLine);
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…