spring 应用有自己的日志记录方式(logback 等),就可以关掉 tomcat 自带的日志记录。
catalina.out
修改 catalina.sh 文件的输出语句
if [ -z "$CATALINA_OUT" ] ; then CATALINA_OUT="$CATALINA_BASE"/logs/catalina.out fi
修改成下面内容
if [ -z "$CATALINA_OUT" ] ; then CATALINA_OUT=/dev/null fi
conf/logging.properties
将 level 级别由 FINE 设置成 WARNING 可以大量减少日志的输出,设置成 OFF,直接禁用掉。
1catalina.org.apache.juli.AsyncFileHandler.level = OFF ...... 2localhost.org.apache.juli.AsyncFileHandler.level = OFF ...... 3manager.org.apache.juli.AsyncFileHandler.level = OFF ...... 4host-manager.org.apache.juli.AsyncFileHandler.level = OFF ...... java.util.logging.ConsoleHandler.level = OFF ############################################################ # Facility specific properties. # Provides extra control for each logger. ############################################################ org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = OFF ...... org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].level = OFF ...... org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].level = OFF
server.xml
注释掉 AccessLogValve
<!--<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t "%r" %s %b" />-->