How to change size of logcat buffer in Android?

匿名 (未验证) 提交于 2019-12-03 08:33:39

问题:

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.

回答1:

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>.



回答2:

"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.



回答3:

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



回答4:

No, as per herelogcat -d -v <mode>.

What is the size limit for Logcat?.

Anyway, for saving logs elsewhere, you have Reading and Writing Logs. That maybe could help you.



回答5:

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



回答6:

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



回答7:

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



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!