How to change size of logcat buffer in Android?

前端 未结 8 423
隐瞒了意图╮
隐瞒了意图╮ 2020-12-28 13:47

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

相关标签:
8条回答
  • 2020-12-28 14:10

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

    0 讨论(0)
  • 2020-12-28 14:10

    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'
    
    0 讨论(0)
  • 2020-12-28 14:14

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

    0 讨论(0)
  • 2020-12-28 14:15

    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.

    0 讨论(0)
  • 2020-12-28 14:16

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

    0 讨论(0)
  • 2020-12-28 14:28

    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.

    0 讨论(0)
提交回复
热议问题