AT Monitor always prints AT responses to logging UART

Hello,

To preface:

  • nRF Connect SDK 2.9.0
  • nRF9151 DK
  • Windows 11 PC

I have the following defined in my prj.conf file:

CONFIG_MODEM_INFO=y

Such that I can use modem_info_string_get() and similar functions to query information from the modem.
My issue is that I see AT command responses printed to my terminal regardless of whether I have logging enabled or not:
*** Booting nRF Connect SDK v2.9.0-7787b2649840 ***
*** Using Zephyr OS v3.7.99-1f8f3dc29142 ***
+CGEV: EXCE STATUS 0
+CEREG: 2,"7B2F","0126020C",7
%MDMEV: PRACH CE-LEVEL 0
+CSCON: 1
+CGEV: ME PDN ACT 0
%MDMEV: SEARCH STATUS 2
+CEREG: 1,"7B2F","0126020C",7,,,"11100000","11100000"
%XTIME: "69","52301112748569","01"
+CGEV: IPV6 0
+CSCON: 0

After a bit of investigation, I see them printing in the following function within at_host.c:

static inline void write_uart_string(const char *str)
{
	if (IS_ENABLED(CONFIG_LOG_BACKEND_UART)) {
		LOG_RAW("%s", str);
		return;
	}

	/* Send characters until, but not including, null */
	for (size_t i = 0; str[i]; i++) {
		uart_poll_out(uart_dev, str[i]);
	}
}

CONFIG_MODEM_INFO 'selects' CONFIG_AT_MONITOR:

https://docs.nordicsemi.com/bundle/ncs-latest/page/kconfig/index.html#CONFIG_MODEM_INFO

This seems wasteful to print these to the UART if I don't need this functionality. In addition, I need full control as to what goes out the UART. Setting CONFIG_LOG=n disables all logging except these AT responses. Setting CONFIG_LOG=y and CONFIG_AT_MONITOR_LOG_LEVEL_OFF=y still doesn't disable logging of these AT responses.

Question: How do I disable the printing of these raw AT responses to the UART, regardless if logging is enabled or not?

It appears that LOG_RAW() ignores the logging level.

Thanks,

Derek

Related