Hello,
I am attempting to write ESP_LOGE messages to a SPIFFS txt file with the use of esp_log_set_vprintf. I am having some success in writing to a my file but for some reason when reading the file my log messages are duplicated
I am writing a total of 5 error log messages and I have a vsprintf function and I'm using fputs(str_buffer) into my file. I am using standard fopen & fclose functions and using the "a" flag with fopen to append to the existing log file in SPIFFS. My log messages always duplicates to 10 log messages when using the "a" flag but when I use the "w" flag I have no issues with writing 5 log messages to SPIFFS. I would like to keep using append so I do not overwrite my the file every time I write a log message to a file. Has anybody tried using the esp_log_set_vprintf before and encountered this issue? Any help would be appreciated.
esp_log_set_vprintf to write to SPIFFS file
-
- Posts: 52
- Joined: Fri Aug 11, 2023 4:56 am
Re: esp_log_set_vprintf to write to SPIFFS file
The SPIFFS filesystem isn't really very POSIX-like at all. You can't just open(..., "a") and go. There's a special method entry point for that.
appendFile(SPIFFS, "/hello.txt", "World!\r\n");
See more at https://github.com/espressif/arduino-es ... st.ino#L72
Supposedly littlefs is less wretched. It's on my short list to move my project to that.
appendFile(SPIFFS, "/hello.txt", "World!\r\n");
See more at https://github.com/espressif/arduino-es ... st.ino#L72
Supposedly littlefs is less wretched. It's on my short list to move my project to that.
Who is online
Users browsing this forum: username and 126 guests