natefinch / lumberjack

lumberjack is a log rolling package for Go
MIT License
4.81k stars 593 forks source link

[question] How lumberjack works when there is a shutdown ? #193

Open cmarmonier opened 11 months ago

cmarmonier commented 11 months ago

Hello,

For my application, I use "lumberjack.v2" with zerolog on Linux embedded system.

Sometime, my application needs to shutdown the system.

In this case, how can I ensure that my log files are not corrupted? How does it work when the Linux stop command is executed? In my application, how can I block writing and know when current writes are finished?

Also, how can I do when power supply stops?

dveeden commented 10 months ago

Looks like you want some way to call Sync() on the file or open the file with O_SYNC.