Skip to content

Bluetooth: Disabling BT_DEBUG_LOG doesn't disable logs #55431

@JordanYates

Description

@JordanYates

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.

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:

#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:

#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)))

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

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions