6 ms·
> Tip: close & re-open the file for each write, so the last and most important tail end of the log doesn't vanish if the app crashes. It sounds like you're loo
by chrsig 4y ago
> Tip: close & re-open the file for each write, so the last and most important tail end of the log doesn't vanish if the app crashes.
It sounds like you're looking for fsync[0]
[0] https://man7.org/linux/man-pages/man2/fdatasync.2.html https://man7.org/linux/man-pages/man2/fdatasync.2.html
- nyanpasu64 4y agoI think it's more important to fflush after logging data, so userspace buffers don't get lost if the app crashes. f[data]sync is only necessary to protect against system crashes.