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

Unable to use NRF_LOG_DEBUG with CLI example

Baseline: CLI example on the 52832 with SDK v15.3

I assume the issue will be some more undocumented fix.

sdk_config.h

// <o> NRF_LOG_DEFAULT_LEVEL  - Default Severity level
 
// <0=> Off 
// <1=> Error 
// <2=> Warning 
// <3=> Info 
// <4=> Debug 

#ifndef NRF_LOG_DEFAULT_LEVEL
#define NRF_LOG_DEFAULT_LEVEL 4
#endif

main.c from the CLI example (UART backend)

NRF_LOG_INFO("This is an INFO Message");
NRF_LOG_DEBUG("This is a DEBUG Message");
NRF_LOG_WARNING("This is a WARNING Message");
NRF_LOG_ERROR("This is a ERROR Message");

Output of the program (If that is too small, the Debug statement is not printed.)

You cannot add a DEBUG color (NRF_LOG_DEBUG_COLOR) because it breaks the build due to redefinition.  However, I do not think that is the problem. 

It is tedious to go through the log code because the code is generated on the fly by 10 deep macros where symbol names are made by ## context.

Anybody have an idea what I am missing.

Thanks,

Jim

Parents
  • Hi,

    If you have dynamic log filtering enabled (NRF_LOG_FILTERS_ENABLED) and CLI commands for log control (NRF_LOG_CLI_CMDS), you should be able to enable debug logs for modules when this have been compiled in (NRF_LOG_DEFAULT_LEVEL=4 and NRF_{MODULENAME}_CONFIG_LOG_ENABLED=1 + NRF_{MODULENAME}_CONFIG_LOG_LEVEL=4), using the CLI command "log enable debug {modulename}.

    The default log severity level is input as a parameter to nrf_cli_init for each backend, for instance uart backend in CLI example:

    ret = nrf_cli_init(&m_cli_uart, &uart_config, true, true, NRF_LOG_SEVERITY_INFO);

    If you modify the last parameter to NRF_LOG_SEVERITY_DEBUG, you should be able to see your debug logs, but note that this will also set the default log level for all modules that have compiled in support for debug level logs to output debug logs.

    Best regards,
    Jørgen

Reply
  • Hi,

    If you have dynamic log filtering enabled (NRF_LOG_FILTERS_ENABLED) and CLI commands for log control (NRF_LOG_CLI_CMDS), you should be able to enable debug logs for modules when this have been compiled in (NRF_LOG_DEFAULT_LEVEL=4 and NRF_{MODULENAME}_CONFIG_LOG_ENABLED=1 + NRF_{MODULENAME}_CONFIG_LOG_LEVEL=4), using the CLI command "log enable debug {modulename}.

    The default log severity level is input as a parameter to nrf_cli_init for each backend, for instance uart backend in CLI example:

    ret = nrf_cli_init(&m_cli_uart, &uart_config, true, true, NRF_LOG_SEVERITY_INFO);

    If you modify the last parameter to NRF_LOG_SEVERITY_DEBUG, you should be able to see your debug logs, but note that this will also set the default log level for all modules that have compiled in support for debug level logs to output debug logs.

    Best regards,
    Jørgen

Children
Related