Tomcat in use will encounter Catalina.out log is too large, the following we use the system (in CentOS as an example) with the logrotate to cut files, to achieve automatic daily log file cutting.
logrotate Program Default program will be cut/etc/logrotate.d/the files defined below, the following methods use the root user action, otherwise you will be prompted insufficient permissions.
To create a file:
#vi/etc/logrotate.d/tomcat
fill in the following information (catalina.out actual path is filled in actual situation):
/usr/local/tomee/logs/catalina.out {
Daily
Rotate 10
Missingok
Dateext
Notifempty
Copytruncate
}
Authorization (in the case of user jjzb I want to use):
#chown Jjzb.jjzb/etc/logrotate.d/tomcat
#chmod +x/etc/logrotate.d/tomcat
Immediately cut to see the effect:
#logrotate--force/etc/logrotate.d/tomcat
650) this.width=650; "src=" Http://www.cnop.net/uploadfile/2016/0823/20160823103858938.png "style=" border:none; Vertical-align:middle;color:rgb (83,83,83); font-family: ' Microsoft Yahei ', ' Microsoft Ya Black ', Arial, ' Lucida Grande ', Tahoma, Sans-serif;font-size:18px;line-height:36px;white-space:normal;width:660px;height:190.538px;background-color: RGB (255,255,255); "/>
If there is no error, the above information will be displayed, resulting in a file ending with a date.
parameter description, the following parameters can be added and deleted according to the actual desired effect:
daily Specify a dump cycle of daily
Rotate 15 Specifies the number of dumps before the log file is deleted, 0 means no backup, 15 means 15 backups are reserved
Missingok If the log does not exist, ignore the warning message
dateext file suffix is a date format, that is, after the cut file is: xxx.log-20150828.gz
Compress post-dump logs via gzip compression (gzip-d xxx.gz decompression)
Notifempty If it's an empty file, don't dump it.
copytruncate for log files that are still open, to back up and truncate the current log
Http://www.cnop.net/html/web/tomcat/2016/0823/4874.html
This article is from "operation and maintenance enthusiasts ..." Blog, be sure to keep this source http://sjby365.blog.51cto.com/4609539/1841418
How Linux systems use Logrotate to cut tomcat logs