Log rotate log from standard out

Either simply pipe to | logger with appropriate flags and use syslog to manage your log file.

Alternative a nice helper program is rotatelogs included in the apache httpd distribution, which takes stdin and will write and rotate logfiles for you eg pipe your output to | /usr/sbin/rotatelogs /home/myprog/myproglog.%Y-%m-%d-%H_%M_%S 2M and create log files of 2 megabytes with unique sequential file names.