Take the 2-minute tour ×

How do i retrieve the error logs of my application from device (and send them over the internet to a server)?

share|improve this question
to clarify - do you mean collect log entries (generated by your app) from other peoples' phones and send to your web server programmatically ? –  Someone Somewhere Jan 24 '11 at 5:44
Ideally, you could make a type of error handling class that is instantiates an object when an error is generated. Once the object is created, it connects and send that log to your webserver. –  Anthony Forloney Jan 24 '11 at 5:50
add comment

2 Answers

up vote 2 down vote accepted

(Assuming you are using log framework from android.util.Log package.)

You can start "logcat" process with specific parameters from within your process. It will dump last 16k of logs (16k - is default for my phone, it can be different on other phones).

Here is an example of command line that dumps all logs: logcat -d -f /mnt/sdcard/log-dump.txt
Another example that dumps errors from all applications: logcat -d -f /mnt/sdcard/err-dump.txt *:e

You'll need to launch the process from within your application programatically. And then process log-dump.txt/err-dump.txt in the way you want.

You also may want to monitor logs longer then those default 16k can allow you. For this you'll need to start logcat without -d parameter. If this is done, logcat process will write logs to file for as long as you want. When you are done just kill logcat process.

In any case you can look & test manually logcat using adb logcat <params> from you computer.

share|improve this answer
add comment

I think you need to implement the try_catch block.


catch(Exception e)
   Log.e("Exception found ",e.getMessage);
   // post the exception message to your server

This way you can send the error log messages to the server.

share|improve this answer
Unless the developer has a serious need for immediate error notifications, this could probably be reduced to once a day or less! –  Hamy Jan 24 '11 at 8:42
add comment

Your Answer


