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?
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.