ESP32 Log Format Produces Garbled Output
DodaTech
Updated 2026-06-26
1 min read
In this tutorial, you'll learn about ESP32 Log Format Produces Garbled Output. We cover key concepts, practical examples, and best practices.
The Problem
ESP32 log messages have garbled formatting, missing arguments, or incorrect type display.
Quick Fix
Wrong
ESP_LOGI(TAG, "Value: %d
", 22.5); // Wrong format specifier
Value: 1234567890
(Garbage from format mismatch)
Right
int intVal = 42;
float floatVal = 22.5;
char* strVal = "hello";
ESP_LOGI(TAG, "int=%d float=%.1f str=%s", intVal, floatVal, strVal);
ESP_LOG_BUFFER_HEX(TAG, data, 16); // Hex dump buffer
I (123) tag: int=42 float=22.5 str=hello
I (124) tag: 7C 9E BD 45 12 78 00 00 00 00 00 00 00 00 00 00
Prevention
Use correct format specifiers: %d for int, %f for float, %s for string, %p for pointer, %x for hex. Use ESP_LOG_BUFFER_HEX for binary data display. Do not add \n at end (added automatically).
DodaTech engineers apply these same patterns across Doda Browser, DodaZIP, and Durga Antivirus Pro for production IoT reliability.
FAQ
← Previous
ESP32 Log Colors Not Rendering in Terminal
Next →
ESP32 Log Tag Not Showing Correct Component
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro