So here it goes.
1) In a directory which the user you are running tomcat can write create a file called logadm.conf with the following content (assuming tomcat is in the /opt/tomcat/ folder):
/opt/tomcat/logs/catalina.out -C 15 -c -t '/opt/tomcat/logs/$basename.%Y-%m-%d'
2) Create a cron job for the same user (assuming you saved the configuration in /opt/tomcat/logrotate):
You can add the cron entry to the user that is running tomcat in the following way:
add the line:
0 0 * * * logadm -f /opt/tomcat/logrotate/logadm.conf
This will make it run every midnight of everyday.
- Explanation on the parameters of logadm
This command, that exists since the solaris 9, will rotate the catalina.out, will rotate the specified log file. The -C tells how many old copies of the files will be kept. The -c is the secret here. It will truncate the log file instead of renaming. This way tomcat keeps the handle to the file and can keep logging. -t uses a template to create the rotated files. Without that it will just append a .1, .2, etc.
You should run it manually before adding to your crontab.
That should be all!!!!