I noticed that the size of the logcat buffer varies on different devices. Assuming I have root permissions on my device, is there a way to change the buffer size of the main buffer at runtime? If not, then assuming I can rebuild the Android image, how do I change it at compile time? I'm looking to enlarge it for diagnostic purposes.
Buffer size: A general rule is that a buffer size of 10 MB per CPU core allows for a trace that's about 20 seconds long.
Logger Buffer Sizes option allows you to change the buffer size of these mentioned buffers. Increasing the buffer size would allow you to capture more logs in the buffer, and reducing the probability of an overwrite in case of high-frequency logs. Setting the option to "OFF" would disable logging.
Logcat is a command-line tool that dumps a log of system messages, including stack traces when the device throws an error and messages that you have written from your app with the Log class. This page is about the command-line logcat tool, but you can also view log messages from the Logcat window in Android Studio.
"Logger buffer size option" in "Developer options"
It allows to change the size to a few values between 64k and 16M.
adb logcat -g
then immediately shows the update limit.
Tested on 5.1.1, and this answer claims that it is a recent addition.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With