It's because once JBoss/Tomcat has an open file handle for server.log it doesn't ever close it and re-open a new file handle. Thus the behavior you see is java continuing to run without writing to a new server.log. If left as is then the server.log will eventually fill up all of your disk space (you'll see a discrepancy between df and du commands in space usage); however, once JBoss is restarted your disk space will be reclaimed until the next time it happens. If you would like to learn more about this behavior then see
this LQ thread.
To answer your question for resolving it you want to use the "copytruncate" option in logrotate (see
man logrotate). An example of using copytruncate.
Code:
/var/log/samba/* {
notifempty
olddir /var/log/samba/old
missingok
sharedscripts
copytruncate
}
EDIT: after some light experimentation I believe pscaltaf is right about it growing after being renamed. I had a process open and looked up its file descriptor based on PID.
Code:
ls -l /proc/1234/fd/
#more generically /proc/<PID>/fd/
When I moved the file and ran the ls command again the file descriptor was still pointing at the renamed file. So the behavior is likely it will keep writing to the renamed file. You'll still have to use the copytruncate option or do the right thing with log4j.
SAM