tomcat日志文件catalina.out过大导致宕机
解决方法:
如果tomcat的日志文件不配置优化,那么所有操作都会写在catalina.out一个文件里,文件会越来越大,按照以下配置,会安装日期生成catalina.out文件,只有启动的信息才会保存
1.修改tomcat的/bin/catalina.sh文件,注释CATALINA_OUT="$CATALINA_BASE"/logs/catalina.out并添加CATALINA_OUT=/dev/null
if [ -z "$CATALINA_OUT" ] ; then
# CATALINA_OUT="$CATALINA_BASE"/logs/catalina.out
CATALINA_OUT=/dev/null
fi
2.在tomcat的/conf目录下如果没有logging.properties就新增,内容:
handlers = 1catalina.org.apache.juli.FileHandler, 2localhost.org.apache.juli.FileHandler,
3manager.org.apache.juli.FileHandler, 4host-manager.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
.handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
1catalina.org.apache.juli.FileHandler.level = FINE
1catalina.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
1catalina.org.apache.juli.FileHandler.prefix = catalina.
3.重启tomcat即可