Logging and diagnostics are an important aspect of any embedded project. In many cases, using an interactive debugger is not possible or not practical. Hardware state can change in a few milliseconds after a program stops on a breakpoint, and a developer has insufficient time to analyze it. Collecting detailed log data and using tools for their analysis and visualization is a better approach for high-performance, multithreaded, time-sensitive embedded systems.
Logging itself introduces certain delays. Firstly, it takes time to format the log messages and put them into the log stream. Secondly, the log stream should be reliably stored in persistent storage, such as a flash card or a disk drive, or sent to the remote system.Â
In this recipe, we will learn how to use logging instead of interactive debugging to find the root causes of issues. We will use...