LOG_DBG message not appear in LTE while LOG_INF works well

I added a new event module to asset_tracker application. The default LOG_DBG messages are very well shown in LTE, but that of my module don't appear in LTE. I replaced LOg_DBG with LOG_INF, then messages are displayed in LTE. What is required to do so that LOG messages appear in LTE ?

Parents Reply
  • Hi,

    The local log level configuration must also be defined in Kconfig. There exists a Kconfig template which makes this much easier. Using this the configuration CONFIG_BMS_MODULE_LOG_LEVEL will be generated if you add the following to your modules Kconfig file:

    module = BMS_MODULE
    module-str = bms_module
    source "subsys/logging/Kconfig.template.log_config"

    You will find many examples of how this is done for other modules in the SDK, for example in the Kconfig module files for the Asset Tracket v2, which can be found in asset_tracker_v2/src/modules/. 

    You must also remember to set the log level for your module in prj.conf if you want to set it to something other than the default log level.

    Another option is to not use optional module log level, and simply register with LOG_MODULE_REGISTER(bms_module), and then set the default log level (CONFIG_LOG_DEFAULT_LEVEL) to debug.

    You should find information about all of this in Logging in a module, which I linked to earlier.

    Best regards,

    Marte

Children
  • Hi, I have already added the suggested code to kconfig file as shown below:

    I observed in the prj.conf only CONFIG_LOG=y is written. Where the LOG level has been set to DBG in default kconfig or .c files in Asset_tracker_v2, I could not find in it ? I searched kconfig.data_module and data_module.c etc .... for cloud, ui, util, modem, sensor etc  ...

  • Hi,

    If you add overlay-debug.conf as overlay config file when building, then the log level of the modules will be set to debug. If not, they should default to info, unless you set the default log level for all modules to debug in prj.conf using CONFIG_LOG_DEFAULT_LEVEL. You can check what the log levels have been set to after building by looking in the file asset_tracker_v2/build/zephyr/.config. If you for example search for CONFIG_SENSOR_MODULE_LOG_LEVEL you will see which level it is set to, for example:

    # CONFIG_SENSOR_MODULE_LOG_LEVEL_OFF is not set
    # CONFIG_SENSOR_MODULE_LOG_LEVEL_ERR is not set
    # CONFIG_SENSOR_MODULE_LOG_LEVEL_WRN is not set
    CONFIG_SENSOR_MODULE_LOG_LEVEL_INF=y
    # CONFIG_SENSOR_MODULE_LOG_LEVEL_DBG is not set
    CONFIG_SENSOR_MODULE_LOG_LEVEL=3

    Best regards,

    Marte

Related