How to read logcat written through my application in all android os -
i need capture logs written through application. know jetllybean os can read need our application log. when tried using command "logcat -d" using exec method application , did not data.
please me on this.
thanks,
saravanakumar
this example playing around before generate log text file in local storage:
private static string generatelogcatlogcommond = "logcat -d > /sdcard/issuereport/log.txt"; public static string generatelogcatlog() throws interruptedexception { try { file issuereport = new file(environment.getexternalstoragedirectory(), "issuereport"); if (!issuereport.exists()) issuereport.mkdir(); file logfile = new file(issuereport,"log.txt"); logfile.createnewfile(); process process = runtime.getruntime().exec("/system/bin/sh -"); dataoutputstream os = new dataoutputstream(process.getoutputstream()); os.writebytes(generatelogcatlogcommond); loglocation = "/sdcard/issuereport/log.txt"; log.d("client", loglocation); } catch (ioexception e) { e.printstacktrace(); } return loglocation; } what above code doing using 'sh' run 'logcat -d' command , save file locally. logcat log. you, can change 'logcat -s ""' , save logcat log of application file.
Comments
Post a Comment