waseemwk
waseemwk

Reputation: 1509

how to write android.util.Log into a plain file on SDCard in android

Hey guys I have created an app and provided to people to use it. They cater different issues in the app. I want to capture all Log activities in the file so that they can give it to me and i can examine the problem. i have searched on internet but not getting clear answer. Can any one tell me how can i redirect Android.util.Log output to a text file.

I have tried this
File filename = new File(Environment.getExternalStorageDirectory() + "/gridlog.log");
filename.createNewFile();
String cmd = "logcat -d -f " + filename.getAbsolutePath();
Runtime.getRuntime().exec(cmd);

now to capture Log in file i used

Log.e("HEY ERROR", "HEY THIS IS ERROR");

but it store lot of irrelavant information in the file..and also i works only ones, later if i want to Log info or error it is not capturing it.

Can any android guru help me here.. Thanks

Upvotes: 0

Views: 1418

Answers (2)

rb512
rb512

Reputation: 6958

A wee bit too late to answer but might help folks in the future. TestFlight's pretty cool free service that allows remote logging, crash reports, beta rollouts, to name a few. Needless to say, these activities can be monitored from your testflight dashboard. Also, supports iOS as well as Android.

Upvotes: 0

EvZ
EvZ

Reputation: 12179


If you want to remotly receieve notifications & error's log / crash reports you can use free services like :
AppHance
BugSense
(I am sure you can find more free service over the web..)

To write the log to SD Card and than to transfer it manually it is not a very clever solution when you have this free cross platform services in my opinion.

Good luck!

Upvotes: 1

Related Questions