How to decode dictionary-based log output

nRF Connect for VS Code

tags
nRF Connect for VS Code

When you work with Zephyr's Dictionary-based logging feature, applications produce coded binary output instead of plain-text log messages. To read these logs in an nRF RTT Terminal or nRF Serial Terminal connection, load the log_dictionary.json file that was generated for the firmware you are running.

Complete the following steps:

  1. Connect to your device using a serial port or RTT.
  2. In the active terminal, click the Select Zephyr Log Dictionary button in the Panel View Toolbar, or run the nRF Terminal: Select Zephyr Log Dictionary command from the Command Palette.

    Select Zephyr Log Dictionary in the Panel View Toolbar

    The extension opens a quick pick that lists all log_dictionary.json files found in the workspace.

    Select a Zephyr log dictionary file

  3. Select the log_dictionary.json file that matches the firmware running on the connected device. The extension loads the dictionary and decodes subsequent log output in the terminal.

Note

The decoding only applies to the active terminal and its result is not persistent.

The following example shows the difference between undecoded output and decoded output after loading a dictionary (log lines that use the format [timestamp] <level> module: message):

00000
   =<00<0
      :><0p00

--- Loading Zephyr log dictionary from build/machine_learning/zephyr/log_dictionary.json ---
*** Booting My Application v3.2.0-0597b6edad9b ***
*** Using nRF Connect SDK v3.3.0-ba167d9f3db4 ***
*** Using Zephyr OS v4.3.99-fd9204a02d52 ***
[   238] <inf> fs_nvs: 8 Sectors of 4096 bytes
[   238] <inf> fs_nvs: alloc wra: 0, fd0
[   239] <inf> fs_nvs: data wra: 0, 1c
[   244] <inf> app_event_manager: e:module_state_event module:main state:READY