This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Debugging problem using NRF_LOG

Hi,

I'm using NRF_LOG for debugging. SDK version is 12.3.0.

I want print error code, File name, Line number.

Error code is printed fine but, file name and line number are not.

Printed like this:

image description

Code is like this :

image description

Am I wrong about using NRF_LOG?

Thanks for reading my question.

Parents Reply Children
  • Thanks for your example. I just noticed that %0 formatters don't work in 12.3.0 in SEGGER ES. 
    So NRF_LOG_ERROR("Error: Code: 0x%04X (%d), Line: %d, File: %s\n\r", p_error_info->err_code, p_error_info->err_code, p_error_info->line_num, (uint32_t)p_error_info->p_file_name);

    Will hang. I went with

    NRF_LOG_ERROR("Error: Code: 0x%X (%d), Line: %d, File: %s\n\r", p_error_info->err_code, p_error_info->err_code, p_error_info->line_num, (uint32_t)p_error_info->p_file_name);

Related