It’s very possible the SPI FLASH memory chip inside the ESP8266 is not behaving well. I have done a number of ESP8266 IOT device developments the last year and can confirm that it’s very hit or miss on how well the SPI memory chip behaves. I see were using the file system library to use a portion of the FLASH as storage space. This in theory should work but obviously the quality of the flash is really the thing were all dependent upon.
In earlier systems with an SDCARD you could remove it and reflash. The above API helps to clear the space but if the bit cells inside are marginal then there is not much you can do. That is a fundamental issue with these low cost WiFi systems. The quality of the components under the hood. I have a new AC 3.0 system and I have been playing with the logging as well. It works for me but I am not convinced it will continue to do so based on my earlier experience. ESP8266’s are great hobbyist systems but they have their limitations IMHO.
I have the system sitting on a desk and will let it run for a couple of weeks before I try to rely upon it to run my system. Yeah I’d a bit pessimistic but like I said early on – I have a bit of experience with the ESP8266 ecosystem.