There is a great answer to that question here: How to avoid apache reload when rotating logs?
They do this because when they open the log file for writing, they receive a file handle. The handle does not change when the file is moved, which means they will think they are writing to the log file, but after it's moved they are writing to the wrong log file. So they gracefully reload when the logs are rotated to make sure they are creating a new file handle that is writing to the proper file location.
If you are concerned about what will happen with your app, you should read more about logrotate, and pay special attention to prerotate
and postrotate
. You can make your program listen for a signal to reset the log handle whenever the log files are rotated, or you can do what the answer to the first link suggested, and just copy the file and truncate the original, so that you don't have to worry about it.