-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Description
Describe the bug
When CONFIG_BT_DEBUG_LOG is not enabled, the log level (CONFIG_BT_HCI_DRIVER_LOG_LEVEL) of Bluetooth drivers can actually increase.
Disabling CONFIG_BT_DEBUG_LOG results in BT_DEBUG not being defined, resulting in BT_HCI_DRIVER not being defined.
zephyr/subsys/bluetooth/common/Kconfig
Lines 382 to 385 in bc5fbc9
| module = BT_HCI_DRIVER | |
| legacy-debug-sym = BT_DEBUG_HCI_DRIVER | |
| module-str = "Bluetooth HCI driver" | |
| source "subsys/bluetooth/common/Kconfig.template.log_config_bt" |
This logging level is used in quite a few locations, for example:
zephyr/subsys/bluetooth/controller/hci/hci.c
Lines 97 to 99 in bc5fbc9
| #define LOG_LEVEL CONFIG_BT_HCI_DRIVER_LOG_LEVEL | |
| #include <zephyr/logging/log.h> | |
| LOG_MODULE_REGISTER(bt_ctlr_hci); |
Because of the behaviour of the logging subsystem when log levels are undefined, in the general case the logs will go to LOG_LEVEL_INF:
zephyr/include/zephyr/logging/log.h
Lines 290 to 293 in bc5fbc9
| #define _LOG_LEVEL_RESOLVE(...) \ | |
| Z_LOG_EVAL(LOG_LEVEL, \ | |
| (GET_ARG_N(2, __VA_ARGS__, LOG_LEVEL)), \ | |
| (GET_ARG_N(2, __VA_ARGS__, CONFIG_LOG_DEFAULT_LEVEL))) |
zephyr/subsys/logging/Kconfig.filtering
Lines 13 to 19 in bc5fbc9
| config LOG_DEFAULT_LEVEL | |
| int "Default log level" | |
| default 3 | |
| range 0 4 | |
| help | |
| Sets log level for modules which don't specify it explicitly. When | |
| set to 0 it means log will not be activated for those modules. |
To Reproduce
Modify samples/bluetooth/scan_adv/prj.conf with
CONFIG_LOG=y
# CONFIG_BT_DEBUG_LOG=y
west build -b nrf52840dk_nrf52840 zephyr/samples/bluetooth/scan_adv/
Expected behavior
Disabling CONFIG_BT_DEBUG_LOG should not result in more logs being printed.
I'm not sure if CONFIG_BT_DEBUG_LOG even makes sense now in the context of logging transitioning to standard LOG_* calls in #51897
Impact
Annoyance
Environment (please complete the following information):
- Zephyr v3.3