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

Not possible to disable the shell as a log backend in Zephyr (for nRF9160)

Hi,

We are using nRF Connect SDK 1.1 for nRF9160.

It is not possible to turn off the shell as a log backend in Zephyr. Is this a bug or a feature? Is there any way I can disable it?

How to reproduce:

1) I set the symbol CONFIG_SHELL_LOG_BACKEND=n in a .conf-file

2) When building I get the warning:

warning: SHELL_LOG_BACKEND (defined at subsys/shell/Kconfig:151) was assigned the value 'n' but got
the value 'y'. This symbol has no prompt, meaning assignments in configuration files have no effect
on it. It can only be set indirectly, via Kconfig defaults (e.g. in a Kconfig.defconfig file) or
through being 'select'ed or 'imply'd (note: try to avoid Kconfig 'select's except for trivial
promptless "helper" symbols without dependencies, as it ignores dependencies and forces symbols on).
You can check symbol information (including dependencies) in the 'menuconfig' interface (see the
Application Development Primer section of the manual), or in the Kconfig reference at
docs.zephyrproject.org/.../CONFIG_SHELL_LOG_BACKEND.html (which is
updated regularly from the master branch). See the 'Setting configuration values' section of the
Board Porting Guide as well. It covers Kconfig.defconfig files.

3) I read about the the config at https://docs.zephyrproject.org/2.1.0/reference/kconfig/CONFIG_SHELL_LOG_BACKEND.html. It confirms that the config cannot be set directly since it has no prompt.

BR / Björn

  • According to the Zephyr manual for that config option, it defaults to yes if CONFIG_LOG is true.

    Have you checked to see if the CONFIG_LOG is being set true by something else if you haven't already set CONFIG_LOG=n?

  • Hi,

    You misunderstand. Clarification:

    1) I have enabled logs thorugh CONFIG_LOG=y, and I want to have logs enabled.

    2) I DONT want to use the shell as a logger backend, I want to turn it off through the setting SHELL_LOG_BACKEND=n, but it does not seem to be possible according to the info I have given.

    3) I want to use the UART as a logger backend instead through CONFIG_LOG_BACKEND_UART=y.

    My question is: Why is it not possible to disable the shell as a logger backend? Is this a bug or by design? I also want to know if it possible to disable it some other way!

    BR / Björn

  • Right ok, well as per the Zephyr documentation, LOG and SHELL_LOG_BACKEND go hand in hand.

    SHELL_LOG_BACKEND is not a user definable symbol and is called indirectly by LOG, you can't have one without the other according to the Zephyr documentation. This would appear not to be a bug but how the actual feature works as they have specified this linkage in the Zephyr Project documentation.

  • Hi,

    On the other hand the documentation of the Shell (https://docs.zephyrproject.org/latest/reference/shell/index.html) indicates (according to my interpretation) that using the Shell as a logger backend is optional:

    Shell as the logger backend

    Shell instance can act as the Logging backend. Shell ensures that log messages are correctly multiplexed with shell output. Log messages from logger thread are enqueued and processed in the shell thread. Logger thread will block for configurable amount of time if queue is full, blocking logger thread context for that time. Oldest log message is removed from the queue after timeout and new message is enqueued. Use the shell stats show command to retrieve number of log messages dropped by the shell instance. Log queue size and timeout are SHELL_DEFINE arguments.

    Warning

    Enqueuing timeout must be set carefully when multiple backends are used in the system. The shell instance could have a slow transport or could block, for example, by a UART with hardware flow control. If timeout is set too high, the logger thread could be blocked and impact other logger backends.

    Warning

    As the shell is a complex logger backend, it can not output logs if the application crashes before the shell thread is running. In this situation, you can enable one of the simple logging backends instead, such as UART (CONFIG_LOG_BACKEND_UART) or RTT (CONFIG_LOG_BACKEND_RTT), which are available earlier during system initialization.

    I cant understand why it should not be possible to disable the Sell as a backend?

    BR / Björn

  • Have you tried just turning the shell off with CONFIG_SHELL=n?

    The shell log depends on SHELL being true so if you have the shell enabled and logging on, it will enable the shell backend

Related