I'm seeing a small amount of logcat entries for my app since Android 13. I can usually only see a few minutes before plugging the phone in to check the logcat. If I leave it plugged in it doesn't clear and I can see as far back as I could when I first plugged it in. It's as if something is clearing the logcat. I have increased the log buffer size to 4M and then 8M and it's still the same. I should be able to see logcat entries from the previous day with such big log buffers. It's also the same whether checking the logcat from Android Studio or from the phone itself with a logcat reader app.
What should I check to solve this?
Related
This morning my Samsung Galaxy Mega 6.3 (Android 4.4.2) rebooted suddenly. I was not doing anything at that time, and it was the very first time when it did that.
I managed to pull out a logcat using adb, but about 11 hours later. Also, I don't think that logcat was enabled on my phone at the time when the error occurred. Is there a way to see an error that is 12 hours long?
I suspect that the phone rebooted due to a system update. Is there a way to see a system update history, perhaps using an app instead of a code? I need the EXACT time (date + hour) of the last update.
Also, I don't think that logcat was enabled on my phone at the time when the error occurred
Logging is always enabled. LogCat simply reports what's in the log.
Is there a way to see an error that is 12 hours long?
The logging area is a ring buffer. It used to be fixed at 64KB. On Android 5.0, it is selectable by you via the Developer Options in the Settings app. I am not sure how big it is on Android 4.4 in general, let alone on a Samsung device.
How old the logs can be therefore is dependent on the size of the ring buffer and how much stuff gets logged. Unfortunately, production hardware logs a lot, so I would be skeptical that you can see 12+ hours back in the log. For example, on my Nexus 5, in a 256KB log buffer, I get about 8 hours of history.
Is there a way to see a system update history, perhaps using an app instead of a code?
Not that I am aware of, though that would be a better question for the Android Enthusiasts Stack Exchange.
Is it possible to get old logs (such as logs of one hour or one day before) of an Android device?
I am asking this because sometimes testers encounter some errors. The Android developer says that the error is related to the device's hardware. To prove his claim, he has to show the error inside the logs. But he says that when attaching an Android device to his computer, he cannot see past logs.
I'm not sure how it was back then, but with current Android versions you can use adb logcat to get at older logs. On my device this is limited to the current boot, but I understand that on some devices older logs may be accessible.
adb logcat --help will have all the details (note that your device must be connected even for the help functionality), here's an example usage:
To get all the logs from today at 4PM:
adb logcat -d -T "2022-01-27 16:00:00.000"
Or:
adb logcat -d -T "01-27 16:00:00.000"
As Year may not be valid in some ADB versions, with message:
-T "2022-01-27 16:00:00.000" not in "%m-%d %H:%M:%S.%q" time format
You can't, but there are libraries like ACRA which will automatically send you detailed crash reports including the user LogCat if you want (disabled by default).
If you don't want to use a library, when an error occurs you can also write the content of the Logcat to a file that your testers can easily find (like in a log folder of the SD card). It shouldn't be very hard to implement.
I think there is no way you can access the past logs, unless you save them.
Ask your testers to save the Log the moment they see the issue.
With the logger buffer size option on the developer option, one could choose the logger size for each buffer. There are quite a several logger sizes available and they include 64k, 256k, 1M, 4M, and 16M. I recommend only increasing the buffer size for debugging purposes, as the logging area is a ring buffer, this helps to capture old logs to some extent once we encounter the glitch that we're looking out for.
I can't figure out what is going on. I am using ANdroid Studio 1.6 and I have made sure I am set to "Verbose" and I have deleted all of my filters. However when I run an application on my device, I see almost no messages. Not absolutely nothing, but maybe a dozen I/D/E level messages from dalvik and the android runtime. NOthing from my application and certainly not enough messages that I would expect from a daily driver device that has a number of apps on it with online services.
I am so confused, I've looked in every corner of the Android Studio configuration and I can't see where I might be missing something. I KNOW that it is suppressing messages because when I use my on-device logcat reader, I see everything just as expected, and it's dramatically different from what AndroidStudio is showing.
Edit: going to terminal emulator on the device and starting log cat had the same effect (messages being hidden) so this must be on the device somewhere.
Tried logcat -c and checked ANDROID_LOG TAGS
Edit2: from terminal emulator if I just type log cat then I have the aforementioned problem. If I type su logcat however then I see everything. Why would I need superuser to view the full logcat?? How would I even instruct ddms to request superuser?
I am experiencing a strange issue.
I am trying to collect some logs from my android phone using logcollector or aLogcat. Everything works just fine for my Nexus S and moto Defy but when I am trying to capture and send a log from Galaxy S the output is very very short. It captures only last few seconds of phone's activity.
Does anybody know how can I fix this?
Regards, Peter
Many possible things can be occurring here. Another process could be clearing the logcat buffer periodically (logcat -c). Galaxy S could have also modified the default buffer size for its logs to be very small (so it is constantly rolling them over). Other than that, who knows what it could be. The best I can think is to enable USB debugging and seeing if you can run logcat yourself and see what you can see (adb logcat). If you can see the logs fine then it is the app otherwise the system does not allow log collection.
use pipeline to save logs in text file from command prompt
adb logcat > logs.txt
I'd like to examine stack traces from the last hours. I haven't found a proper logcat command. Does Android "forget" those logs?
First story:
When I find an unhandled exception in my co-workers Iphone App, he connects the iphone to his computer and reads the stack trace into x-code. X-Code also visualizes the exception in a nice way.
Is there a smth. similar in Android?
You probably won't be able to see those logs from the past hours. Imagine that your phone stores all logs, how much space will it consume in a couple of days?
So, this is what I do:
I'm in the autobus, and suddenly the app I'm working on crashes!
I'd like to see what's the logcat output to analyze it at home
I just launch the Android log collector app, and send myself an email with the logcat output
I get home, have dinner, feed the dogs and then I can start working on the logtrace I emailed hours ago.