'Access old/past logs from logcat or Android
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.
Solution 1:[1]
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.
Solution 2:[2]
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'
Solution 3:[3]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Nargis |
| Solution 2 | Guss |
| Solution 3 |

