tomcat修改控制台日志输出到文件的解决办法
把控制台的信息输出到
%CATALINA_BASE%\\logs\\catalina.out里:
一、修改
startup.bat
中
call \"%EXECUTABLE%\" start %CMD_LINE_ARGS%
为
call \"%EXECUTABLE%\" run %CMD_LINE_ARGS%
二、修改catalina.bat中Djava.io.tmpdir
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%
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_ARG
S% %ACTION%
goto end
:doJpda
if not \"%SECURITY_POLICY_FILE%\" == \"\" goto doSecurityJpda
%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% -Xdebug
-Xrunjdwp:transport=%JPDA_TRANSPORT%,address=%JPDA_ADDRESS%,server=y,suspend=n
%DEBUG_OPTS% -classpath
-Djava.endorsed.dirs=\"%JAVA_ENDORSED_DIRS%\"
\"%CLASSPATH%\" -Dcatalina.base=\"%CATALINA_BASE%\"
-Dcatalina.home=\"%CATALINA_HOME%\"
-Djava.io.tmpdir=\"%CATALINA_TMPDIR%\" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%
goto end
:doSecurityJpda
%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% -Xdebug
-Xrunjdwp:transport=%JPDA_TRANSPORT%,address=%JPDA_ADDRESS%,server=y,suspend=n
%DEBUG_OPTS% -classpath
-Djava.endorsed.dirs=\"%JAVA_ENDORSED_DIRS%\"
\"%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%
goto end
为:
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%
>> %CATALINA_BASE%\\logs\\catalina.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%
>> %CATALINA_BASE%\\logs\\catalina.out
goto end
:doJpda
if not \"%SECURITY_POLICY_FILE%\" == \"\" goto doSecurityJpda
%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% -Xdebug
-Xrunjdwp:transport=%JPDA_TRANSPORT%,address=%JPDA_ADDRESS%,server=y,suspend=n
%DEBUG_OPTS% -classpath
-Djava.endorsed.dirs=\"%JAVA_ENDORSED_DIRS%\"
\"%CLASSPATH%\" -Dcatalina.base=\"%CATALINA_BASE%\"
-Dcatalina.home=\"%CATALINA_HOME%\"
-Djava.io.tmpdir=\"%CATALINA_TMPDIR%\" %MAINCLASS% %CMD_LINE_ARGS% %ACTION%
>> %CATALINA_BASE%\\logs\\catalina.out
goto end
:doSecurityJpda
%_EXECJAVA% %JAVA_OPTS% %CATALINA_OPTS% -Xdebug
-Xrunjdwp:transport=%JPDA_TRANSPORT%,address=%JPDA_ADDRESS%,server=y,suspend=n
%DEBUG_OPTS% -classpath
-Djava.endorsed.dirs=\"%JAVA_ENDORSED_DIRS%\"
\"%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%
>> %CATALINA_BASE%\\logs\\catalina.out
goto end
因篇幅问题不能全部显示,请点此查看更多更全内容