catalina.out ゝ一世哀愁。 2022-05-22 09:56 150阅读 0赞 win下tomcat中的logs中没有catalina.out文件。使用如下方式创建。 一、创建catalina.out 1、修改tomcat bin目录下的startup.bat文件 修改位置:在startup.bat文件倒数第二行 修改call "%EXECUTABLE%" start%CMD\_LINE\_ARGS% 为:call "%EXECUTABLE%" run %CMD\_LINE\_ARGS% 2、修改catalina.bat文件 修改位置:catalina.bat文件最后几行 修改为(修改处已用红色标记): 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\_%DATE:~0,4%-%DATE:~5,2%-%DATE:~8,2%.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\_%DATE:~0,4%-%DATE:~5,2%-%DATE:~8,2%.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% >> "%CATALINA\_BASE%"\\logs\\catalina\_%DATE:~0,4%-%DATE:~5,2%-%DATE:~8,2%.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% >>"%CATALINA\_BASE%"\\logs\\catalina\_%DATE:~0,4%-%DATE:~5,2%-%DATE:~8,2%.out goto end :end 3、启动startup.bat文件 查看tomcat logs目录下是否存在catalina.out文件 二、如何实时查看catalina.out文件? 1、安装rktools.exe文件 记录安装路径 2、将rktools.exe安装路径添加PATH环境变量中 在cmd下tail /?,出现以下信息则说明安装成功了: ![110939059024034.jpg][] 3、在tomcat bin 目录下新增tomcat\_s1log.bat文件(文件名可以自行定义),内容如下: @echo off if not exist "%CATALINA\_BASE%"\\logs\\catalina\_%DATE:~0,4%-%DATE:~5,2%-%DATE:~8,2%.out echo "" > "%CATALINA\_BASE%"\\logs\\catalina\_%DATE:~0,4%-%DATE:~5,2%-%DATE:~8,2%.out tail -f %CATALINA\_BASE%\\logs\\catalina\_%DATE:~0,4%-%DATE:~5,2%-%DATE:~8,2%.out ![110939279814988.jpg][] 4、修改catalina.bat文件 185行:echo Using JRE\_HOME: "%JRE\_HOME%" goto java\_dir\_displayed :use\_jdk echo Using JAVA\_HOME: "%JAVA\_HOME%" :java\_dir\_displayed echo Using CLASSPATH: "%CLASSPATH%" 修改为: echo Using JRE\_HOME: "%JRE\_HOME%" tomcat\_s1log.bat goto java\_dir\_displayed :use\_jdk echo Using JAVA\_HOME: "%JAVA\_HOME%" :java\_dir\_displayed echo Using CLASSPATH: "%CLASSPATH%" 5、启动startup.bat 会看到两个控制台 一个启动信息界面 一个实时日志监控界面 (注:如果想把tomcat\_s1log.bat放在桌面启动 则需要修改tomcat\_s1log.bat 里面的"%CATALINA\_BASE%"修改为对应的tomcat目录。) 例: d: cd D:\\\\Program Files\\\\apache-tomcat-7.0.5\\\\logs if not exist catalina\_%DATE:~0,4%-%DATE:~5,2%-%DATE:~8,2%.out echo "" > catalina\_%DATE:~0,4%-%DATE:~5,2%-%DATE:~8,2%.out tail -f catalina\_%DATE:~0,4%-%DATE:~5,2%-%DATE:~8,2%.out [110939059024034.jpg]: /images/20220522/9fa4e4441f4640bd8852978fee919a6d.png [110939279814988.jpg]: /images/20220522/494bbfb4b52c4cdc9418cfdcc5425ce1.png
还没有评论,来说两句吧...