Disable SHELL logger backend at runtime

Hi,

I have the logging module activated with two backends UART and RTT. The SHELL module is using UART. I'm trying to control the SHELL UART logging backend at runtime, as I need to disable logs going through UART at certain conditions and re-enable them later.

This is the .conf file flags

CONFIG_USE_SEGGER_RTT=y
CONFIG_LOG_BACKEND_RTT=y
CONFIG_LOG_BACKEND_UART=y
CONFIG_SHELL_LOG_BACKEND=y

I used the z_shell_log_backend_disable() API, but I'm still seeing logs on the SHELL/UART. Is there other way to disable the shell uart logging backend?

    // disable shell log backend
    z_shell_log_backend_disable(shell_backend_uart_get_ptr()->log_backend);

Related