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.
-
Nice doc is in http://elinux.org/Android_logger. – pevik Dec 17 '15 at 09:08
8 Answers
"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.

- 347,512
- 102
- 1,199
- 985
See current buffer size
adb logcat -g
Set all type buffer size (main, system, crash)
adb logcat -G 16M # 16M can be replace by (128K ~ 16M)
Set specific type buffer size (main, system, crash)
adb logcat -b system -G 8M # system can be replaced with 'main' or 'crash'

- 37,929
- 33
- 189
- 256
-
-
@YoavFeuerstein some manufacturers/os might override that standards so there can be exceptions. – Sazzad Hissain Khan Apr 25 '20 at 10:29
-
thanks for the warning! Do you know of any specific examples and how it affects this command? – Yoav Feuerstein Apr 26 '20 at 05:54
-
-
-
I've noticed that when I use `adb logcat -G` to change the buffer size that it does not retain the change on a reboot of the device, and the Developer Options screen continues to display the old setting. Any idea why? – Holistic Developer Oct 29 '21 at 13:29
-
1Found my answer at https://stackoverflow.com/a/57657874/137646. The boot option is based on the property `persist.logd.size`. – Holistic Developer Oct 29 '21 at 21:35
Set the size of the log ring buffer
adb logcat -G <size>
Append K or M to indicate kilobytes or megabytes
Example: adb logcat -G 512K

- 3,408
- 10
- 42
- 71
According to the newsgroup Android Developers, logcat buffer size:
The log buffers on the device are 64 KB. The timestamp, process ID, and log level are stored in a compact format, so you may actually get more than 64 KB of formatted data out of
logcat -d -v <mode>
.

- 30,738
- 21
- 105
- 131
-
1Should the buffer size be updated? I got 256Kb when I ran `adb logcat -g` to check the buffer information. – hackjutsu Jun 01 '15 at 21:06
-
1@Cosmoandcat that number was accurate in Android 2.4 and lower. You are likely on Android 4.x. The size increased in 3.0. Nature of updates. – cde Aug 29 '15 at 10:30
-
See the answer https://stackoverflow.com/a/56730011/1084174 if you want to set size for specific buffer type – Sazzad Hissain Khan Jun 24 '19 at 04:52
No, as per here it seems that the log buffers on the device are 64 KB. The timestamp, process ID, and log level are stored in a compact format, so you may actually get more than 64 KB of formatted data out of logcat -d -v <mode>
.
See also Stack Overflow question What is the size limit for Logcat?.
Anyway, for saving logs elsewhere, you have Reading and Writing Logs. That maybe could help you.

- 30,738
- 21
- 105
- 131

- 5,651
- 3
- 22
- 37
The buffer size is determined by the kernel, found in */drivers/staging/android/logger.c.
Which buffers are used and the size has changed with Android versions. Android 3.0 (Honeycomb) and newer also have a system buffer, and all four are 256 KB. You have to recompile the kernel to change it.

- 30,738
- 21
- 105
- 131

- 317
- 1
- 18
You can increase the value of idea.cycle.buffer.size=1024 in property file android-studio\bin\idea.properties. This worked for me.

- 1,726
- 2
- 17
- 13
To set logcat buffer to 16Mb for a specific Android device through adb, I used:
adb -s 2615a1d4e3174a6e logcat -G 16M
But you can use just:
adb logcat -G 16M
Or set previous buffer size with:
adb logcat -G 256K

- 11,345
- 4
- 67
- 71