Where does system.out.println in tomcat under windows gets written?

不想你离开。 提交于 2019-12-04 00:24:16

System.out.println() prints out to stdout. Therefore, if you want to see these statements in a log file, you can just redirect stdout where you want it in the Tomcat startup script.

When running Tomcat on unixes, the console output is usually redirected to the file named catalina.out. The name is configurable using an environment variable. (See the startup scripts).

http://tomcat.apache.org/tomcat-7.0-doc/logging.html#Console

If you are running a JSP then you need to add

 <%@ page isThreadSafe="false"  %>

Then all of your System.out.printlns will start showing up in the catalina.out file.

If you start tomcat with Catalina.sh run from a command line you will see the prints in the output.

You can find those logs also in cat /var/log/messages

if you try

cat /var/log/messages | grep server

You can find it inside TOMCAT_HOME/logs/stdout_20130104.txt (the file name may change but the log files are usually in the folder TOMCAT_HOME/logs/.

And for me all the sysouts that I have in my code are written in such a file.

In my case (Fedora 29 apache-tomcat-8.5.39), it was found inside catalina.out file located inside logs folder.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!