Buffer magazine on Xiaomi: what size to choose and how to set up

The log buffer on Xiaomi smartphones is a critical but often overlooked component of the system, which is responsible for storing error logs, debugging information and system events that help diagnose crashes, optimize performance, or even recover data after critical errors. However, standard MIUI settings are far from optimal: too small a buffer leads to the loss of important logs, and too large a buffer leads to unnecessary memory consumption and slowdown of the device.

In this article, we will look at how to choose a log buffer size for different use cases (from everyday use to custom firmware debugging), how to configure it through an engineering menu or ADB, and what hidden MIUI parameters affect logging system events.

What is a magazine buffer and why is it needed for Xiaomi?

A log buffer is a dedicated RAM area (RAM) where the system temporarily stores the kernel, drivers, and application logs. Unlike persistent logs that are written to disk (e.g., /data/log), the buffer operates in real time and is cyclically overwritten when overflowed.

  • πŸ” Failure diagnosis: When a smartphone suddenly shuts down or freezes, it is the log buffer that contains the last records of the system state before the incident.
  • πŸ› οΈ Firmware debugging: Custom developers ROM use buffer logs to find bugs in the kernel or drivers.
  • ⚑ Performance optimization: Log analysis helps identify bottlenecks in the processor, memory, or network modules.
  • πŸ“± Data recovery: In some cases, fragments of lost information can be extracted from the buffer (for example, after resetting settings).

On Xiaomi smartphones, the magazine buffer is set to the minimum size (usually 256-512 KB), which is enough for basic diagnostics, but not enough for deep debugging. Moreover, in MIUI, some logs are deliberately limited for security and privacy reasons, which makes analysis difficult for power users.

⚠️ Warning: Increasing the size of the log buffer beyond reasonable limits (over 4 MB) can cause system slowdowns, especially on devices with 4 GB of RAM or less. On the Redmi Note 9–11 series and POCO X3 models, this manifests as slowdowns when multitasking.

Standard magazine buffer sizes for different tasks

The best buffer size depends on what you use it for, and the table below is recommended for different scenarios:

Use case scenarioRecommended buffer sizeExamples of devicesFeatures
Everyday use512 KB - 1 MBRedmi 10, POCO M4 ProEnough for basic diagnosis without loss of performance.
Custom firmware debugging2-4 MBXiaomi 12T, POCO F4 GTAllows you to record long-term logs of the kernel and modules.
Application development1-2 MBBlack Shark 5, Xiaomi Mix 4You need to track logcat and dmesg logs.
Recovery from disruption4-8MBXiaomi 13 Ultra, POCO F5Maximum size for saving logs before a critical error.

For most users, the best trade-off is 1MB. It’s enough to capture critical events (such as camera driver errors or 5G module errors), but it doesn’t overload the system. If you’re developing or testing firmware, you can increase the buffer to 4MB, but only on devices with 6GB of RAM and above.

πŸ“Š What kind of Xiaomi smartphone do you have?
Redmi (series 9-12)
POCO (F/X/M series)
Xiaomi (series 11–13)
Black Shark
Other

How to change the size of the magazine buffer on Xiaomi

The log buffer can be configured in two ways: through the engineering menu (for official firmware MIUI) or using the ADB- commands (a universal method for any firmware, including custom ones).

Method 1: Through the Engineering Menu (MIUI)

This method works on most Xiaomi devices with official firmware, but requires activation of the developer mode:

  1. Go to Settings β†’ About Phone and 7 times click on the MIUI Version to unlock the Developer Mode.
  2. Return to Settings β†’ Additional β†’ For developers and enable the option to debug over USB.
  3. Open the Phone app and enter the code ##4636## (some models may not work – see the alternative below).
  4. In the menu that appears, select Phone Information β†’ Log settings (or Logging settings).
  5. Find the Log buffer size and set the desired value (in bytes, for example, 1048576 for 1 MB).

If ##4636### doesn’t work, try an alternative way through the MTK Engineering Mode app (for MediaTek devices) or Qualcomm Service Menu (for Snapdragon), which can be found on the 4PDA forum in your model’s themes.

What to do if the engineering menu is not available?
Some MIUI firmware (especially global ones) have blocked access to log settings, leaving only the ADB method or /system/build.prop file editing (requires root rights).

Method 2: A Universal Method (ADB)

To change the size of the buffer through ADB, follow the following steps:

  1. Connect your smartphone to your PC and make sure that USB debugging is enabled.
  2. Open the command prompt (Windows) or terminal (Linux/macOS) and type:
adb shell


su




echo 2097152 > /proc/sys/kernel/printk_ratelimit_burst




echo 1048576 > /sys/module/printk/parameters/console_suspend

Here:

  • 2097152 – buffer size in bytes (2 MB).
  • console_suspend is a parameter responsible for logging during sleep of the device.

To save the changes after the reboot, you need to edit the file /system/build.prop (root rights required) and add lines:

persist.logd.size=2M


persist.logd.filter=all

⚠️ Warning: Incorrect editing of build.prop can lead to bootloop (locked device turn on).Before making changes, back up the file!

Install ADB-PC drivers|

Enable debugging over USB on your phone |

Download the Android SDK Tools| platform

Check the connection with the adb devices | command

Create a backup of current settings (adb backup)

-->

Optimization of the magazine buffer for custom firmware

On custom firmware (e.g. LineageOS, ArrowOS or Pixel Experience), the approach to configuring the log buffer is different from MIUI. Logging is often more flexible, but requires manual configuration.

  • πŸ“Š No restrictions MIUI: Custom firmware does not block access to full kernel logs (dmesg) and system events.
  • πŸ”§ Magisk module support: You can install Logcat Extender or Kernel Logger modules for advanced logging.
  • βš™οΈ Init.d configuration: Scripts in the /system/etc/init.d folder allow you to automate the change in buffer parameters when booting.

An example of a script for init.d that increases the buffer to 4 MB and includes logging all events:

#!/system/bin/sh


echo 4194304 > /sys/module/printk/parameters/console_suspend




echo 8 > /proc/sys/kernel/printk




chmod 666 /dev/log/main




chmod 666 /dev/log/system

To install the script:

  1. Create a 99-logbuffer file in the /system/etc/init.d folder.
  2. Give it execution rights: chmod 755 /system/etc/init.d/99-logbuffer.
  3. Reset the device.

On firmware with support for Magisk, you can use the LogEnabler module, which automatically applies the optimal buffer settings and saves the logs to /sdcard/logs.

πŸ’‘

If after installing custom firmware smartphone began to slow down, check the size of the log buffer command cat /proc/sys/kernel/printk. value above 7 may indicate excessive logging.

How to read and save logs from the journal buffer

Even after you set up the buffer, the contents are useless unless you know how to extract and analyze the logs.

Team team.DescriptionExample of inference
dmesgShows the kernel logs (drivers, hardware events).[ 123.456789] mmc0: error -110 whilst initialising SD card
logcatLogs of applications and system services.E/AndroidRuntime(1234): FATAL EXCEPTION: main
cat /proc/kmsgStreaming reading of kernel logs in real time.<6>[12345.678901] thermal_engine: Mitigation: CPU0
adb logcat -d > log.txtSave logs to a file on a PC.log.txt file with full history of events.

To save logs to a device without a PC, you can use applications:

  • πŸ“± Logcat Extreme allows logs to be filtered by importance level (ERROR, WARNING, INFO).
  • πŸ“± MatLog – supports color markup and log search.
  • πŸ“± aLogcat is open source, no ads.

If you need to analyze logs after a crash (such as bootloop), use fastboot mode:

fastboot boot twrp.img


adb pull /proc/last_kmsg

The last_kmsg file contains the last kernel recordings before an emergency shutdown.

Common mistakes and their solutions

When you use a magazine buffer, you often have typical problems, and here are the most common ones and how to fix them:

  • 🚫 Logcat does not show logs: check if debugging is enabled with USB and if there are no filters in the application. Also make sure the buffer is not crowded (clear it with logcat -c command).
  • πŸ”„ "Legs break after reboot": this is normal buffer behavior. To keep logs constant, use logcat -f /sdcard/log.txt.
  • ⚠️ "Device brakes after buffer enlargement": Reduce the size to 1 MB or turn off logging of unnecessary modules (e.g. net or battery).
  • πŸ”’ "No access to /proc/kmsg": some firmware requires root rights. Try using su -c "cat /proc/kmsg."

If after changing the buffer, the smartphone stopped booting, try resetting the settings via fastboot:

fastboot erase cache


fastboot reboot

In extreme cases, you will have to reflash the device through the Mi Flash Tool.

πŸ’‘

Before any manipulation of the log buffer, back up your current logs with the adb bugreport command, which will help you recover information if something goes wrong.

Security and privacy: what is stored in the buffer

The log buffer contains not only technical information, but also data that may pose a risk to privacy:

  • πŸ“ Location: Logs GPS and network modules can reveal your location.
  • πŸ“ž Phone numbers: Outbound/inbound calls are stored in the phone logs (ril).
  • 🌐 URL- Addresses: browsers and applications can record pages visited.
  • πŸ”‘ Authorization Tokens: Some applications log temporary access keys.

To minimize the risks:

  1. Clean the buffer regularly: logcat -c or dmesg -c.
  2. Use the filters: logcat | grep -v "password\|token\|location".
  3. Disable logging of sensitive modules (such as gps or telephony).

On MIUI firmware, some of the logs are encrypted, but this does not guarantee full protection. If you sell or transfer a device, make a full reset (fastboot erase userdata), because even after a normal reset via the menu, some of the logs can remain in memory.

FAQ: Frequent questions about magazine buffer on Xiaomi

Can I increase the journal buffer without root rights?
Yes, but with limitations. With ADB (no root), you can change the buffer size temporarily, but after you reboot, the settings will reset. Permanent changes require root rights or custom recovery like TWRP.
What is the minimum buffer size sufficient to diagnose hangings?
To fix critical errors (for example, kernel panic) will be enough 512 KB. However, to analyze the causes of freezes (for example, driver conflicts) it is better to install 2 MB.
Why did the smartphone warm up after increasing the buffer?
Excessive logging is straining the processor, especially if high-frequency events (such as sensors or network packets) are recorded in the buffer, reduce the size of the buffer, or turn off logging of unnecessary modules via /sys/kernel/debug/tracing.
Can I recover the deleted logs from the buffer?
No, the log buffer works on the principle of ring storage: new data overwrites old ones, but if logs were saved to disk (for example, through logcat -f), they can be restored using utilities such as Autopsy or PhotoRec.
Which Xiaomi models support advanced logging?
All devices on Qualcomm Snapdragon processors (e.g. Xiaomi 12/13 series, POCO F4/F5) and MediaTek Dimensity (Redmi Note 12 Pro+) support buffer settings. On budget models (e.g. Redmi A1), the options may be limited.