in reply to Limiting log file size
Set up your program so that when it receives a signal (SIGHUP or SIGUSR1 for example) it sets a flag. In the course of the main loop, if the flag is set call a routine which closes and reopens your log filehandle. Then you can just use something like logrotate to do the rotation.
Another possibility would be to use your platform's syslog facility and let whatever handles rotating those log files deal with things
|
|---|