ESP32-C3 Arduino USB read/write without debug print

Using an ESP32-C3 board, I need to use the USB peripheral with CDC for the main application in firmware, and the UART0 port for debug printing.

The problem seems to be that I can either get debug printing on only the UART port, but USB serial comms don’t work, or the ESP_LOG output goes to both the UART and USB depending on the states of:
ARDUINO_USB_MODE
and
ARDUINO_USB_CDC_ON_BOOT

How can I keep debug printing to the UART port, but use the USB peripheral for various Serial (read and write) functionality?

Did yo uset up your UART as second Serial, i.e. Serial1?

ARDUINO_USB_CDC_ON_BOOT=1 and USB_MODE=1 will give you the objects Serial which is of type HWCDC and outputs to the USB-port , Serial0 and Serial1 which are of type HardwareSerial and output to UART0 and UART1.

If you set Serial0.debugOutput(true); your Serial.print statements should ogo to the USB serial port and log_xxx should go to UART0.