I am developing an application and during my testing on a real device I have found that it will crash and cause the phone to reboot (worrying I know...)
Is there any way I retrieve the logcat from before the phone rebooted as the logcat seems to reset when the phone boots up.
Thanks in advance.
Use http://code.google.com/p/acra/, which is a great lib to send crash reports to a google form incl. stack trace. I use it in my app and works nicely. Let me know if you have any difficulties implementing it.
Read the http://code.google.com/p/acra/wiki/ACRAHowTo, it's easy to setup.
From slashfoo's blog, (check the logcat page for exact syntax)
hook up your computer to start off the logcat process in the background.
adb shell nohup logcat -f /dev/[your sdcard] -n60 -r3600
Although it means logcat will be saved to the sdcard but every time you reboot, you must perform the procedure again.
Easiest way:
Get aLogrec from Market for free.
This app saves the logs to sdcard.
Use the alogrec program. It writes the log to the SD card, and will automatically resume after rebooting.
Updating for 2019, Fabric, which was purchased by Google, does an excellent job of remote logging app crashes. Integration into the app was simple, and it is free (at least at whatever level I'm using it).
It has been extremely valuable to finding defects in my apps.
https://www.fabric.io
Try to open a terminal/command prompt and issue this in it :
adb -d logcat
This should dump you a live version of the logcat you could read to find the problem
Related
I'm trying to remove bloatware from my Vivo X70pro+ (origin OS) via ADB, but it shows this error message Uninstall_Failed_User_Restricted. Some apps i can remove but some i can't (example:- global search, weather, imusic.. are some of them). Someone please help me rectify this problem.
I'm guessing those are system apps which as far as i know, can only be disabled.
I did find a thread on XDA
Although it's for x60-pro but am sure you can get some useful stuffs.
I'm trying to figure out what is producing this debug output:
04-25 15:58:04.883 1542-5012/? D/NetworkStatsCollection: getHistory:mUID 10266 isVideoCallUID: false
The above output runs continuously with my phone plugged in. I don't see this using the emulator and I've uninstalled the app I'm working on, so I don't think it's that. I've tried restarting the phone, to no avail. How can I determine what app is causing this?
Use adb shell ps | fgrep 1511 to see what app is tied to the PID of 1511, which according to your LogCat output is the app that is doing the logging.
(BTW, in the future, please post LogCat output as text, not screenshots)
How can I see timestamp in Logcat? Is there any application which shows me the log along with the timestamp? Also, how can I increase the size of the Log in andriod phone?
To get timestamps: logcat -v time
To run logcat on the device at a shell prompt: logcat
There are several free logcat viewers for Android. I've heard that aLogCat is pretty good.
EDIT
You can set your preferences in aLogCat to see the time.
Regarding your second question, I found an answer here:
The logs are held by a kernel device; the entries are in /dev/log.
The buffer is currently 64KB, and there is no way to change the size
on a production device.
The easiest way to keep more of the log is to run "logcat" and send
the output to a file. logcat runs on the device, so you could run it
there and redirect it to (say) /sdcard/log.txt.
I want to dump all logs out to test a long usage of my app, maybe 2-3 days, but the logs seem to be cleared out while running after a long time.
How can I keep the logs?
I do not want to connect my device with eclipse all the day, I want the log just keep for me, like store it in the sd card for further check.
I had same requirement for my application. By default there is logcat process that tracks logs up to around 64kb (depends on device).
You can start your own logcat process using adb shell with some custom arguments. For example:
adb shell logcat -f /mnt/sdcard/large.log -r 100 -n 10
This will save up to 1mb of logs evenly distributed among 10 files (large.log, large.log.0, larget.log.1, etc.);
The next step is to launch logcat from your application:
String [] args = new String[] { Logcat, "-v", "threadtime",
"-f", logFile.getAbsolutePath(),
"-r", Integer.toString(sizePerFile),
"-n", Integer.toString(rotationCount),
"*:"+filter};
Runtime.getRuntime().exec(args);
So now your app may start saving logs. But you should be careful not to enable this in your production versions of application (or at least make this opt-in feature).
Instead of using the eclipse log use the apps like 'log viewer'. I think that app can solve your issue. I think the log will remain until you clear the log manually in 'log viewer'. I just downloaded it today morning and still has the logs of actions I performed just after I switched on the device.
Did you try dumping the log to a file?
adb logcat > log.txt
Sometimes we see the device restarts automatically, while few other times I had found it switching off after long time, even battery was not low.
So if we want to trace back of what actually has caused this, does we have any log file in device memory which has the cause of shutdown or restart ?
Like we get the dump for the other O.S. for any errors occured causing it to restart/shutdown in specific error log file. Similarly does android has such ?
It may be anywhere , even in internal memory, so with root privileges I can go into looking for it.
Any thoughts ? Thanks.
If you have installed Terminal on your phone just tupe in
su
logcat
If not enable DebbugingMode on your phone, connect it with your PC/Mac, open Eclipse and go to Debug.
There it will show the log of the phone.
I hope this helps.