Log2file not working for me (esp32)

Hi, first day using PlatformIO on VSCode. I want to log some readings from an ADC. I was using esp-idf monitor for that, I could redirect the printf output to a text file. I tried on platformIO to set the log2file filter in my platformio.ini. But I just get an empty .log file. Here is my .ini file:

platform = espressif32
board = az-delivery-devkit-v4
framework = espidf
monitor_speed = 115200
monitor_flags = --raw
monitor_filters = log2file, debug

And my code use simple printf statements like:

dac_out_value = dac_out_value + 1;
printf("%d,", dac_out_value);
dac_output_voltage(DAC_CHANNEL_1, dac_out_value);
read_raw = adc1_get_raw(ADC1_CHANNEL_0);
printf("%d\n", read_raw);

How can I solve this and log the voltages to a file?

You are using the monitor flag --raw, which will instruct the device monitor to skip all filtering and processing, including the log2file filter. Remove the flag and the filter should work again.

1 Like

this worked for me. remove (monitor_flags = --raw) and the log already saves what is in the terminal