In Linux, logs generated by Tomcat are not generated by date. as a result, logs become larger and larger, which is inconvenient to view. it is troublesome to manually back up logs. you can modify catalina. sh file to achieve the effect. The method is very simple. find the following code and modify it as follows (pay attention to the total score of the red font ):...
In Linux, logs generated by Tomcat are not generated by date. as a result, logs become larger and larger, which is inconvenient to view. it is troublesome to manually back up logs. you can modify catalina. sh file to achieve the effect.
The method is very simple. find the following code and modify it as follows (pay attention to the total score of the red font ):
Shift
Touch "$ CATALINA_BASE"/logs/catalina 'date + % Y % m % d'. out
If ["$1" = "-security"]; then
Echo "Using Security Manager"
Shift
"$ _ RUNJAVA" $ JAVA_OPTS $ CATALINA_OPTS \
-Djava. endorsed. dirs = "$ JAVA_ENDORSED_DIRS"-classpath "$ CLASSPATH "\
-Djava. security. manager \
-Djava. security. policy = "$ CATALINA_BASE"/conf/catalina. policy \
-Dcatalina. base = "$ CATALINA_BASE "\
-Dcatalina. home = "$ CATALINA_HOME "\
-Djava. io. tmpdir = "$ CATALINA_TMPDIR "\
Org. apache. catalina. startup. Bootstrap "$ @" start \
> "$ CATALINA_BASE"/logs/catalina 'date + % Y % m % d'. out 2> & 1 &
If [! -Z "$ CATALINA_PID"]; then
Echo $! > $ CATALINA_PID
Fi
Else
"$ _ RUNJAVA" $ JAVA_OPTS $ CATALINA_OPTS \
-Djava. endorsed. dirs = "$ JAVA_ENDORSED_DIRS"-classpath "$ CLASSPATH "\
-Dcatalina. base = "$ CATALINA_BASE "\
-Dcatalina. home = "$ CATALINA_HOME "\
-Djava. io. tmpdir = "$ CATALINA_TMPDIR "\
Org. apache. catalina. startup. Bootstrap "$ @" start \
> "$ CATALINA_BASE"/logs/catalina 'date + % Y % m % d'. out 2> & 1 &
If [! -Z "$ CATALINA_PID"]; then
Echo $! > $ CATALINA_PID
Fi
Fi