BLE logging not showing inf and dbg

Hi,

i am working on the nrf5280, and I have set up BLE with NUS so I have a shell and logging over BLE, as well as logging over UART.

I have a python script running that connects and is able to send shell commands and that works great.  

However, it will only show logs that are WRN or ERR, and doesn't show DBG or INF, but the uart does.

I've tried setting several different kconfig options with no luck


```

bt_nus:~$ logtest all
All log levels printed
[00:00:22.112,884] <wrn> log_test: Test warning message (all levels test)
[00:00:22.112,884] <err> log_test: Test error message (all levels test)`

```

```

[00:00:22.112,854] <dbg> log_test: prv_cmd_log_all: Test debug message (all levels test)
[00:00:22.112,884] <inf> log_test: Test info message (all levels test)
[00:00:22.112,884] <wrn> log_test: Test warning message (all levels test)
[00:00:22.112,884] <err> log_test: Test error message (all levels test)

```

CONFIG_LOG_MAX_LEVEL=4
CONFIG_LOG_DEFAULT_LEVEL=3
  • Can you add CONFIG_LOG_RUNTIME_FILTERING=y and then at runtime, use this command: "log enable dbg" 

    CONFIG_LOG_MAX_LEVEL=4 and CONFIG_LOG_DEFAULT_LEVEL=3  ensure DBG/INF logs are compiled in, but each backend may still apply its own filter. The UART backend usually prints all level while NUS shell seems to default at ERR/WRN.

    If this doesn't work, try to run "log status" to see the status of your logging modules.


  • Running "log enable dbg" works, and right now I can have my python script that runs on the PC side automatically send that once it connects, but I'd prefer to have the device set the config. is it possible to do it with kconfigs or programatically?

    I tried doing it programatically similar to how I have changed the log level during runtime for things coming over the uart but it didn't work the same, I'm assuming for the reason you gave earlier.

  • Can you try enabling CONFIG_BT_NUS_CLIENT_LOG_LEVEL_DBG=y and CONFIG_BT_LOG_LEVEL_DBG=y?

    Also refer to this documentation on the logging module Logging

  • Hi,

    I have been playing around with this and am still having the same issue, nothing in the documentation has helped.

    I tried the kconfigs you suggested, they enable dbg messages from the BT modules (like bt_conn and bt_hci_core)  but I don't want those, I just want the messages from my app, which is what the logging on uart shows.


  • Hi, sorry you are correct, those would just enable logs from the BT modules.
    Unfortunately, I can't find any built in Kconfig that would enable this. So, your best bet is to do this in app if you don't want to let the python script handle it.

    I suggest taking a look at your \zephyr\include\zephyr\shell folder 

    I haven't tested this yet but something like this might work.

    #include <zephyr/shell/shell_backend.h>
    #include <zephyr/shell/shell.h>
    
    static int raise_all_shells_to_dbg(void)
    {
        int n = shell_backend_count_get();
        for (int i = 0; i < n; ++i) {
            const struct shell *sh = shell_backend_get(i);
            if (sh) {
                shell_execute_cmd(sh, "log enable dbg");
            }
        }
        return 0;
    }
    
    


    Let me know if you succeed

Related