using logcat I can see the log messages generated by my app in the emulator. How can I read/retrieve the same log file but this time from the device the app is running on ? The device is not attached to any computer and the log file has to be sent via email.
Asked
Active
Viewed 4,630 times
3 Answers
3
To read the log from within your application you need to have the android.permission.READ_LOGS permission.
Once you have that, you could start up a process to read logcat with something like
Process logcatProcess = Runtime.getRuntime().exec("logcat");
Then you can create a buffered reader from it:
BufferedReader logcat = new BufferedReader(new InputStreamReader(logcatProcess.getInputStream()), 8192);
From here you can String s = logcat.readLine();
to read the log.

mah
- 39,056
- 9
- 76
- 93
1
There is a log collector project that you can use from your code/application. If you want an already existing application, try Log Collector.

WarrenFaith
- 57,492
- 25
- 134
- 150
0
Check out this app on the market. It does what you need and it is open source!

Haphazard
- 10,900
- 6
- 43
- 55