Where does system.out.println in tomcat under wind

2019-04-04 16:14发布

I am using a third party library (cannot modify it) that uses for logging system.out.println statements. The output shows fine in the console but I am not able to retrieve those information in the catalina[...].log file?

Is it possible to send those to log4j?

5条回答
疯言疯语
2楼-- · 2019-04-04 16:55

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.

查看更多
3楼-- · 2019-04-04 16:57

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.

查看更多
太酷不给撩
4楼-- · 2019-04-04 17:05

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.

查看更多
forever°为你锁心
5楼-- · 2019-04-04 17:11

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

查看更多
相关推荐>>
6楼-- · 2019-04-04 17:15

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

if you try

cat /var/log/messages | grep server
查看更多
登录 后发表回答