Android adb logcat 設定改變 buffer size 加大緩衝區大小

本篇 ShengYu 介紹 Android 的 adb logcat 如何設定 buffer size 改變緩衝區大小,以便取得更多的 log。

查看目前 logcat 的 buffer size,指令如下,

1
adb logcat -g

以我手上的 Android 裝置為例的話,結果如下,

1
2
3
4
$ adb logcat -g
main: ring buffer is 256Kb (200Kb consumed), max entry is 5120b, max payload is 4076b
system: ring buffer is 256Kb (33Kb consumed), max entry is 5120b, max payload is 4076b
crash: ring buffer is 256Kb (0b consumed), max entry is 5120b, max payload is 4076b

logcat 中的 buffer size 類型共有三種,分別為 system main crash。

設定 logcat 中所有類型的 buffer size 為 16M,指令如下,

1
adb logcat -G 16M

以我手上的 Android 裝置為例的話,結果如下,

1
2
$ adb logcat -G 16M
$ adb logcat -g

如果單位是要用 kilobytes 的話可以這樣下,

1
adb logcat -G 512K

設定 logcat 中 system 類型的 buffer size 為 8M,指令如下,

1
adb logcat -b system -G 8M

以上就是 Android adb logcat 設定改變 buffer size 加大緩衝區大小教學介紹,
如果你覺得我的文章寫得不錯、對你有幫助的話記得 Facebook 按讚支持一下!

其他參考
How to change size of logcat buffer in Android? - Stack Overflow
https://stackoverflow.com/questions/12397780/how-to-change-size-of-logcat-buffer-in-android
usb debugging - How do I increase the size of logcat buffers? - Android Enthusiasts Stack Exchange
https://android.stackexchange.com/questions/17572/how-do-i-increase-the-size-of-logcat-buffers
How to Increase the Logcat Buffer Size
https://pspdfkit.com/blog/2018/how-to-increase-the-logcat-buffer-size/

相關主題
Android adb 基本用法教學
Android adb 同步時間/設定時間
Android adb shell input 事件用法
Android adb forward 通訊埠轉發用法教學
Anddroid VS Code 遠端除錯教學