How to save logcat android as request
I know save logcat to file.txt in android But I wanna filter logcat in output. For example I just wanna write all logcat except I:info to text file. How can I do that.
Here my code to save logcat, It’s writing all info( above priority V(verbose)) to file.
private void logFile(){
try {
File[] storages = getExternalMediaDirs();
String path = storages[1] + "/"+ DeviceConfig.getInstance().getDeviceID() + "_log.txt"; //save file to my SDCard
Runtime.getRuntime().exec(new String[]{
"logcat", "-f", path, "MyappTAG:V"
}); //write all logcat
} catch (IOException e) {
Log.d(TAG,"Logcat Error: " + e);
}
}
tks for any help
Read more here: Source link