How can i read filtered log cat whereLevel
is Warning?
That's all i know....
logcat = Runtime.getRuntime().exec(new String[]{"logcat", "-d"});
br = new BufferedReader(new InputStreamReader(logcat.getInputStream()),4*1024);
String line;
final StringBuilder log = new StringBuilder();
String separator = System.getProperty("line.separator");
while ((line = br.readLine()) != null)
{
log.append(line);
log.append(separator);
}
The -s flag lets you filter logcat output based on tag and level e,w,d,v so you can try modifying your line.
logcat = Runtime.getRuntime().exec(new String[]{"logcat", "-d","-s","*:w"});
if (line.contains("WARN")) {
// ...
}
try {
Process process = Runtime.getRuntime().exec("logcat -d");
BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(process.getInputStream()));
StringBuilder log=new StringBuilder();
String line = "";
while ((line = bufferedReader.readLine()) != null) {
log.append(line);
}
TextView tv = (TextView)findViewById(R.id.textView1);
tv.setText(log.toString());
} catch (IOException e) {
}
Hope u get what u want....