android - How to store logcat output with all filters & tags in a file on SdCard? -
i using code save logcat output sdcard :-
public string readfromcmd(string[] strcmdargs) { processbuilder cmd; string result=""; try { cmd = new processbuilder(strcmdargs); process process = cmd.start(); inputstream in = process.getinputstream(); bufferedreader reader = new bufferedreader( new inputstreamreader(process.getinputstream())); int read; char[] buffer = new char[4096]; stringbuffer output = new stringbuffer(); process.waitfor(); while ((read = reader.read(buffer)) > 0) { output.append(buffer, 0, read); } reader.close(); result = output.tostring(); in.close(); } catch(exception ex){ ex.printstacktrace(); } return result; }
here able save logs file.
with command.
string[] args_logs_save = "/system/bin/logcat -v time -d -b radio -b events -b main -b system".split(" "); readfromcmd(args_logs_save);
question here :- logs save application package, not complete logcat output "i/wifihw, w/activitymanager, d/hwcomposer, d/wpa_supplicant" etc tags...
when execute "/system/bin/logcat -v time -d -b radio -b events -b main -b system" manually adb shell, execute , give me output
but when execute above code, give output package only.
so getting logcat above code ?
note:
i using android 4.1 & 4.2
reference links : link1, link2, link3, link4
if know please help, thanks.
before android 4.1 apps read_log_permission
access logging other programs, changed in android jelly bean. security reasons android 4.1 , later allow read logging own program. unfortunately, change has not been documented google (see this discussion)
afaik workaround root device , either run program root or run command chmod 04755 /system/bin/logcat
(see this post)
Comments
Post a Comment