Automatic / Periodic Flushing of Apptrace-based Logging

p-rimes
Posts: 89
Joined: Thu Jun 08, 2017 6:20 pm

Automatic / Periodic Flushing of Apptrace-based Logging

Postby p-rimes » Fri Jan 31, 2020 5:39 pm

I am trying to use apptrace/TRAX-based logging to replace the default UART-based logging for my application.

It seems to be working, if I add this early in my app_main function

Code: Select all

esp_log_set_vprintf(esp_apptrace_vprintf);
However I must manually call

Code: Select all

esp_apptrace_flush(ESP_APPTRACE_DEST_TRAX, 100000);
to flush the collected logs out of TRAX and into the logtrace_proc.py script.

I'd like to have the logs flushed automatically (ideally as fast as possible), so long as it is not worse than UART, performance-wise. Is there a way to configure that, or is there something I'm doing incorrectly that is preventing that?

ESP_Alexey
Posts: 24
Joined: Fri Dec 02, 2016 8:55 pm

Re: Automatic / Periodic Flushing of Apptrace-based Logging

Postby ESP_Alexey » Mon Feb 03, 2020 10:07 am

I'd like to have the logs flushed automatically (ideally as fast as possible),
Actually the data are flushed automatically when TRAX HW buffer (16KB) is filled. But to flush them as fast as possible you need to call

Code: Select all

esp_apptrace_flush()
manually now. For now I would suggest to write your own vprintf-like function which will call

Code: Select all

esp_apptrace_vprintf()
and

Code: Select all

esp_apptrace_flush()
just after that. And register that function using

Code: Select all

esp_log_set_vprintf(your_own_apptrace_vprintf);

p-rimes
Posts: 89
Joined: Thu Jun 08, 2017 6:20 pm

Re: Automatic / Periodic Flushing of Apptrace-based Logging

Postby p-rimes » Wed Feb 12, 2020 6:07 pm

Works for me! Thanks for your suggestion.

Who is online

Users browsing this forum: No registered users and 165 guests