The relationship between Tomcat logsA picture is worth a thousand words! In other logs such as Split catalina.out As shown in the figure above, catalina.out will only get bigger as the running time gets longer, but the logs output by the console are also useful. For example, some developers like to use The easiest way is to use the logrotate function that comes with Linux to split catalina.out. Take the catalina.out path as #Enter /etc/logrotate.d. This directory is the configuration directory of the logrotate.d subsystem. It is not recommended to modify the main configuration file. cd /etc/logrotate.d cat > tomcat<<EOF /opt/tomcat/logs/catalina.out{ copytruncate daily rotate 15 compress missingok notifempty size 200M dateext } EOF The above configuration description:
More configuration parameters: compress #Compress the dumped logs with gzip nocompress #Do not perform gzip compression copytruncate #Used for log files that are still open, back up and truncate the current log; it is a copy-first-then-clear method. There is a time difference between copying and clearing, and some log data may be lost. nocopytruncate #Backup the log file but do not truncate it create mode owner group #Specify the properties of creating new files during rotation, such as create 0777 nobody nobody nocreate #Do not create a new log file delaycompress #When used with compress, the dumped log file will not be compressed until the next dump nodelaycompress #Override the delaycompress option and compress while dumping. missingok #If the log is missing, no error is reported and the next log is rolled. errors address #Error messages during storage are sent to the specified Email address ifempty #Even if the log file is empty, the file is rotated. This is the default option of logrotate. notifempty #When the log file is empty, do not rotate mail address #Send the dumped log file to the specified E-mail address nomail #Do not send the log file when dumping olddir directory #Put the dumped log file in the specified directory, which must be in the same file system as the current log file noolddir #Put the dumped log file and the current log file in the same directory sharedscripts #Run the postrotate script, which is used to execute the script once after all logs are rotated. If this is not configured, the script will be executed once after each log rotation. prerotate #Instructions to be executed before logrotate dumps, such as modifying file attributes and other actions; must be independent lines. postrotate #Instructions to be executed after logrotate dumps, such as restarting (kill -HUP) a service! Must be a separate line daily #Specify the dump cycle as dailyweekly #Specify the dump cycle as weeklymonthly #Specify the dump cycle as monthlyrotate count #Specify the number of dumps before the log file is deleted. 0 means no backup, 5 means retaining 5 backupsdateext #Use the current date as the naming formatdateformat .%s #Use with dateext, appear immediately on the next line, define the file name after the file is cut, must be used with dateext, only supports %Y %m %d %s these four parameterssize value and unit #The log file is dumped when it reaches the specified size. The missing unit is bytes, which can be specified in KB or MB For more parameters, please refer to the article: https://cloud.tencent.com/developer/article/1681716 This is the end of this article about the relationship between various Tomcat logs and the segmentation of catalina.out files. For more information about the segmentation of Tomcat catalina.out files, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Life cycle and hook functions in Vue
>>: CSS float (float, clear) popular explanation and experience sharing
Closure implementation of private variables Priva...
In order to facilitate the storage and access of ...
Preface Now the operating system used by my compa...
Table of contents Question: Case (1) fork before ...
Let our users choose whether to move forward or ba...
The image can be easily pushed directly to the Do...
Create docker-compose.yml and fill in the followi...
Table of contents Docker version Install Docker E...
Table of contents 1. Check the status of the serv...
What is the function of this key attribute? Let’s...
MySQL binary installation method Download mysql h...
Write a SQL first SELECT DISTINCT from_id FROM co...
Table of contents 01. Use useState when render is...
1. Absolute path First of all, on the local compu...
1. Storage Engine In the last section, we mention...