Tomcat automatic cutting log (Windows), tomcat Cutting
Step 1: Obtain cronolog
Download cronolog-win32
Step 2: Put cronolog.exe in the bin directory of tomcat after decompression Step 3: Modify the tomcat startup. bat file
Call "% EXECUTABLE %" start % CMD_LINE_ARGS %
Replace
Call "% EXECUTABLE %" run % CMD_LINE_ARGS %
Step 4: Modify the catalina. bat file of tomcat
Add the last few lines, and the red arrow marks the end of each line with the red font
Rem Execute Java with the applicable properties
If not "% JPDA %" = "" goto doJpda
If not "% SECURITY_POLICY_FILE %" = "" goto doSecurity
% _ EXECJAVA % JAVA_OPTS % CATALINA_OPTS % DEBUG_OPTS %-Djava. endorsed. dirs = "% JAVA_ENDORSED_DIRS %"-classpath "% CLASSPATH %"-Dcatalina. base = "% CATALINA_BASE %"-Dcatalina. home = "% CATALINA_HOME %"-Djava. io. tmpdir = "% CATALINA_TMPDIR %" % MAINCLASS % CMD_LINE_ARGS % ACTION % | D: \ apache-tomcat-7.0.54 \ bin \ cronolog.exe D: \ logs \ catalina. % Y-% m-% d. out
Goto end
: DoSecurity
% _ EXECJAVA % JAVA_OPTS % CATALINA_OPTS % DEBUG_OPTS %-Djava. endorsed. dirs = "% JAVA_ENDORSED_DIRS %"-classpath "% CLASSPATH %"-Djava. security. manager-Djava. security. policy = "% SECURITY_POLICY_FILE %"-Dcatalina. base = "% CATALINA_BASE %"-Dcatalina. home = "% CATALINA_HOME %"-Djava. io. tmpdir = "% CATALINA_TMPDIR %" % MAINCLASS % CMD_LINE_ARGS % ACTION % | D: \ apache-tomcat-7.0.54 \ bin \ cronolog.exe D: \ logs \ catalina. % Y-% m-% d. out
Goto end
: DoJpda
If not "% SECURITY_POLICY_FILE %" = "" goto doSecurityJpda
% _ EXECJAVA % JAVA_OPTS % CATALINA_OPTS % JPDA_OPTS % DEBUG_OPTS %-Djava. endorsed. dirs = "% JAVA_ENDORSED_DIRS %"-classpath "% CLASSPATH %"-Dcatalina. base = "% CATALINA_BASE %"-Dcatalina. home = "% CATALINA_HOME %"-Djava. io. tmpdir = "% CATALINA_TMPDIR %" % MAINCLASS % CMD_LINE_ARGS % ACTION % | D: \ apache-tomcat-7.0.54 \ bin \ cronolog.exe D: \ logs \ catalina. % Y-% m-% d. out
Goto end
: DoSecurityJpda
% _ EXECJAVA % JAVA_OPTS % CATALINA_OPTS % JPDA_OPTS % DEBUG_OPTS %-Djava. endorsed. dirs = "% JAVA_ENDORSED_DIRS %"-classpath "% CLASSPATH %"-Djava. security. manager-Djava. security. policy = "% SECURITY_POLICY_FILE %"-Dcatalina. base = "% CATALINA_BASE %"-Dcatalina. home = "% CATALINA_HOME %"-Djava. io. tmpdir = "% CATALINA_TMPDIR %" % MAINCLASS % CMD_LINE_ARGS % ACTION % | D: \ apache-tomcat-7.0.54 \ bin \ cronolog.exe D: \ logs \ catalina. % Y-% m-% d. out
Goto end
Step 5: restart
Files of the corresponding date are generated in the specified directory, and the system time is modified to test whether files of the next day are automatically generated across days.
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.