Users of the Xiaomi ecosystem often face the need for deep diagnostics of the device, especially when developing applications, searching for the causes of system failures or trying to customize firmware through ADB. At this point, the critical question arises: what level of journaling (log level) to activate to get the most useful information, but not drown in gigabytes of junk data? Incorrect choice of parameter can lead to overflow of memory or, conversely, to the lack of the necessary entries in the log.
Understanding the log hierarchy is the foundation for anyone who wants to understand the “inner kitchen” of the MIUI or HyperOS Android operating system. The standard set of levels includes VERBOSE, DEBUG, INFO, WARN, ERROR and FATAL, and each of them performs its unique function in the debugging process. The choice of a particular layer directly affects the performance of the device at the time of data collection and the readability of the final report.
In this article, we will take a look at each level, explain where a filter is appropriate, and give you practical advice on how to work with console utilities. You will learn how to filter noise and find the exact lines of code that indicate the source of the problem, which is a knowledge that is necessary for enthusiasts and professional developers working with the Xiaomi platform.
Logging Hierarchy in Android and Specificity of Xiaomi
Android’s logging system is built on a strict hierarchical principle, where each layer is nested in the previous one. When you select a certain threshold, such as INFO, the system starts recording messages of this level and everything that is “higher” in importance (WARN, ERROR), but ignores the more detailed layers (DEBUG, VERBOSE), on Xiaomi devices this structure is complemented by its own system services that can generate specific logs.
The main difficulty is that standard settings often hide the most detailed data. Access to the full range of logging levels usually requires developer mode on and tools like adb logcat. It is important to understand that activating too low level (for example, VERBOSE) on a working device can cause a noticeable drop in performance due to intensive write to disk.
⚠️ Attention: Permanent log entry of level logs VERBOSE or DEBUG internal memory can cause a fast wear of flash memory and a significant decrease in the system response speed. Use these modes only briefly for a specific error.
Xiaomi developers are introducing additional logging mechanisms for MIUI Optimizer telemetry and debugging into their shells, processes that can generate a huge data stream that often does not carry a payload for the average user, but is critical for the company’s engineers, so it is important to be able to cut off system noise when analyzing it yourself.
Level analysis: from VERBOSE to FATAL
The lowest and most detailed layer is VERBOSE, which is designed to output every message an application or system can generate, and it's where you can find information about every step of code execution, real-time values of variables and stream state, and for the average user, this level is almost useless because of the sheer volume of data.
Level. DEBUG This is the information that's useful to the developer in the process of writing code: function calls, conditions check, object status. If you're trying to figure out why Xiaomi GetApps crashes when you start it up, it's the same thing that you're trying to figure out. DEBUG-Logic will help you see the last successful step before the crash.
The higher layer is INFO. This is the standard level for reporting normal system operation. It records service launches, network connection, successful module loading. If the device is running properly, the logs will be dominated by INFO records, which are useful for analyzing the sequence of events that led to a state.
- 🔹 WARN — warnings about potentially dangerous situations that have not yet caused a failure, but may do so in the future (memory shortage, connection timeouts).
- 🔴 ERROR — Errors that cause an operation to fail but do not stop the entire application or system from running.
- 🛑 FATAL — critical errors resulting in an immediate process termination or device restart.
The choice between these levels depends on your goal. If the phone just goes dumb but doesn't fly, watch WARN and INFO. If the app closes itself, look for ERROR and FATAL. For a deep analysis of system freezes, you may need to descent to DEBUG.
Practical Application: When and What to Choose
When looking for the reasons for the unstable operation of a particular application on a Xiaomi smartphone, for example, “camera” or “gallery”, the most effective will be the choice of the ERROR level in combination with WARN. This will cut off thousands of lines of normal system operation and focus on the moments when something went wrong.
If you are developing your own software or modifying system files (for example, through Magisk modules), you will need the DEBUG layer. It will show the interaction of your code with the MIUI system APIs. However, it is worth remembering that on modern versions of HyperOS, access to some Debug logs may be limited by security policies.
MIUI's Hidden Logs
To diagnose network or Bluetooth problems, Xiaomi devices often don’t have enough standard logs. In such cases, experts recommend switching to specialized buffers or increasing the detail to VERBOSE only while the problem is played.
⚠️ Note: When analyzing network issues on Xiaomi, pay attention to wlan logs and bluetooth host. INFO Can hide details of handshake with router, necessary for diagnosis of communication breaks.
Using the right log level saves you time, and instead of scrolling through 10,000 lines of text, you can see 50 lines that contain the essence of the problem, which is especially true when working with crowded logs, where finding a needle in a haystack can take hours.
Tools for working with logs on Xiaomi
The main tool for working with magazines is the utility adb (Android Debug Bridge). To connect to the Xiaomi device, you need to turn on “Debugging by Debugging”. USB» The team to run log monitoring looks universal, but it has its own filtering nuances.
To start viewing logs in real time, the command is used:
adb logcat -v timeHere, the -v time parameter adds timestamps, which is critical to correlating events with user actions, so to filter out only errors, you can add a level:
adb logcat *:EWhere * stands for all tags and E is the ERROR layer. Xiaomi devices also benefit from the built-in Service & feedback app, which can collect logs in a user-friendly format, albeit with less flexible filtering settings.
☑️ Preparation for the collection of logs
Comparative table of journaling levels
To organize information and quickly navigate the level, it is convenient to use a pivot table, which will help you to compare the type of problem with the required level of detail and the expected amount of data.
| Level. | Code. | When to use | Data volume |
|---|---|---|---|
| VERBOSE | V | Deep core debugging, search for rare stream races | Huge. |
| DEBUG | D | Application development, search for logical errors | Big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big big |
| INFO | I | Monitoring of regular work, analysis of sequence | Medium. |
| WARN | W | Finding potential problems, lack of resources | Low. |
| ERROR | E | Diagnosis of departures, failures of functions | Minimum |
As you can see from the table, the transition from DEBUG to ERROR reduces the amount of data by orders of magnitude. For most user tasks, such as figuring out the cause of battery discharge or spontaneous reboots, the WARN and ERROR levels are sufficient. The deeper levels require specialized knowledge to interpret.
💡
The optimal balance between informativeness and data volume for diagnosing most Xiaomi problems is achieved at the WARN level.
Optimization and cleaning of logs
Constant log accumulation, even at the ERROR level, can take up space in the system partition. On Xiaomi devices with a small amount of memory, this can be a problem. Regular cleaning of the log buffer is a good practice of system maintenance.
To clean the current log buffer through ADB, the command is used:
adb logcat -cSome Xiaomi models also offer automatic rotation and log cleanup via the engineering menu, but don’t rely on it if you’re actively debugging, and in such cases, it’s better to manually control the size of the logs or redirect their output to a file on a PC.
Importantly, some MIUI system services may be able to ignore a cleanup command if they have blocked a log file, in which case it may be necessary to restart the device or stop a particular service via ADB.
💡
Use the grep (or findstr in Windows) command along with the logcat to search for specific keywords in the log stream, such as adb logcat | grep"NullPointerException."This will save you hours of manual search.
Security and confidentiality when collecting logs
By collecting logs, especially at the DEBUG and VERBOSE levels, you risk capturing sensitive information. Logs can contain passwords, authorization tokens, location data, and contact lists if the application does not follow best security practices.
When you send your logs to developers or post them on forums, be sure to check the content for personal data. Log files received from Xiaomi devices often contain unique Mi Account and IMEI identifiers that must be blurred before publication.
Use log anonymization tools or manually check before sending a file, which will protect your account from potential hacking or cloning.