You indicated in the comments that the reason for this is that the user is allowed to delete the log file, in which case you want the application to start writing new things in their place.
The traditional UNIX mechanism for this is for your program to install a signal handler (often for SIGHUP , because otherwise it does not make sense to the daemon). The signal handler contains code to close the program and reopen the log file.
Then the user is informed that after deleting the log file they need to send SIGHUP to the program.
source share