Page 1 of 1

[Solved] Logging debug output while using the serial port for function

Posted: Thu Oct 06, 2016 1:16 am
by kolban
I have an application which is using the serial port for function. What I am finding is that the "log" component (which I have been happily and liberally using) now is stepping over the output of my serial output data from my app. My next quest will be to start looking at the logging functions to see if there are any techniques where the output can be redirected elsewhere. I'm wondering (outloud) if it can't be sent via a TCP/IP connection to some listener that merely logs it. Alternatively, a second serial output would be useful.

Re: Logging debug output while using the serial port for function

Posted: Thu Oct 06, 2016 2:48 am
by WiFive
Well you have 3 UARTs, silent boot, log levels, and can redirect stdout via syscalls so the world is your oyster.

Re: Logging debug output while using the serial port for function

Posted: Thu Oct 06, 2016 3:01 am
by ESP_igrr
Log component does allow you to set an output function, so redirecting to network should be easy.

https://github.com/espressif/esp-idf/bl ... log.h#L121

The problem right now is that some closed source parts still use ets_printf and printf to log things, instead of using log component. This will be fixed after holidays. If you need a quick workaround, you can run `xtensa-esp32-elf-objcopy --redefine-symbol ets_printf=ets_printf_wrap libxxx.a` for each library in components/esp32/lib. Same for printf, rename it to printf_wrap. Then define empty `ets_printf_wrap` and `printf_wrap` functions in your application. This should remove all unsolicited messages from the closed-source part.

Re: [Solved] Logging debug output while using the serial port for function

Posted: Mon Sep 04, 2017 9:47 am
by chaotaklon
The info in this page is helpful.
https://esp-idf.readthedocs.io/en/v1.0/api/log.html

Note that esp_log_set_level("*", ESP_LOG_ERROR); is incorrect.
According to this page: https://github.com/espressif/esp-idf/bl ... /esp_log.h
it should be: esp_log_level_set("*", ESP_LOG_ERROR);