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

disable logging

I want to disable logging (which is working OK). In my app.config.h I have set the following:

#undef NRF_LOG_ENABLED
#define NRF_LOG_BACKEND_SERIAL_USES_UART 0
#define NRF_LOG_BACKEND_SERIAL_USES_RTT 1
#define NRF_LOG_DEFAULT_LEVEL 4

Now I get this during linking:

...../../../main.c:130: undefined reference to `nrf_log_frontend_std_0'
...../../../main.c:134: undefined reference to `nrf_log_frontend_std_1'

What have I forgotten please?

Parents
  • Hi Ole,

    Kind of solved.

    I thought all logging would be disabled by defining NRF_LOG_ENABLED=0. I see that this does not remove the print calls. It only seems to remove the calls to the "getchar" functionality, as follows:

    #if NRF_MODULE_ENABLED(NRF_LOG)
    #define NRF_LOG_INTERNAL_GETCHAR()  nrf_log_getchar()
    #else
    #define NRF_LOG_INTERNAL_GETCHAR()  (void)
    

    The print code appears not to be guarded by a similar conditional compile.

    Solution

    #define NRF_LOG_DEFAULT_LEVEL 0
    

    Is this the correct method for disabling logging?

Reply
  • Hi Ole,

    Kind of solved.

    I thought all logging would be disabled by defining NRF_LOG_ENABLED=0. I see that this does not remove the print calls. It only seems to remove the calls to the "getchar" functionality, as follows:

    #if NRF_MODULE_ENABLED(NRF_LOG)
    #define NRF_LOG_INTERNAL_GETCHAR()  nrf_log_getchar()
    #else
    #define NRF_LOG_INTERNAL_GETCHAR()  (void)
    

    The print code appears not to be guarded by a similar conditional compile.

    Solution

    #define NRF_LOG_DEFAULT_LEVEL 0
    

    Is this the correct method for disabling logging?

Children
No Data
Related