Reputation: 119
I am working on a project which will not be published in google play. My client is running it on beta. They says it crashes sometimes, but I was never able to reproduce the scenarios.
So I just want to generate a LOG file when the app crashes. Is it possible to get such events?
i.e When the app forces to close I need to generate a log file with the last few actions ( logcat items) .
Upvotes: 4
Views: 6792
Reputation: 1906
The best and easiest way to log error to a the phone's storage device I found is this which refers to a tutorial here
Upvotes: 0
Reputation: 1459
use crittercism library crittercism crash reporting
this sends crash logs on your registered account and you can register email id's on which you want crash logs
Upvotes: 0
Reputation: 26034
Following is the code which allows you to generate a log file from "logs".
try {
Process process = Runtime.getRuntime().exec("logcat -d");
BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(process.getInputStream()));
StringBuilder log=new StringBuilder();
String line;
while ((line = bufferedReader.readLine()) != null) {
log.append(line);
}
}
catch (IOException e) {
//handle exception
}
Permission you need to take is
<uses-permission android:name="android.permission.READ_LOGS"/>
Upvotes: 3
Reputation: 2882
You can tell your client to install aLogcat ,using this he can get the log of your app
Here is the link aLogcat
Upvotes: 3
Reputation: 389
You can register UncaughtExceptionHandler for your application and log unexpected crashes to file.
Check this out, Global uncaught exception handler -> email log to me?
Upvotes: 0