[Solved] Logging debug output while using the serial port for function
[Solved] Logging debug output while using the serial port for function
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.
Last edited by kolban on Thu Oct 06, 2016 3:40 am, edited 1 time in total.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
Re: Logging debug output while using the serial port for function
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
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.
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.
-
- Posts: 4
- Joined: Thu Aug 31, 2017 6:06 am
Re: [Solved] Logging debug output while using the serial port for function
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);
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);
Who is online
Users browsing this forum: bfredo123 and 96 guests