-   Programming (
-   -   system.out.println() not working in servlet, Tomcat (

Ethan 05-29-2002 03:30 PM

system.out.println() not working in servlet, Tomcat
Trying to insert a print statement into a servlet to print to standard output. Servlet is running within Tomcat 4.0.1 and I've verified that it is loading and running.

I'm using KDE on RH 7.2 on a Thinkpad T22. I open a console window and would like to see the output there.

In the past this procedure worked fine under Tomcat 3.1.

system.out.println() is supposed to send data to standard output. Is there some other way to view standard output?



orgcandman 05-29-2002 03:46 PM

System.out.println() should print to the console just fine, but I suggest investing in a better outputting system. Check out apache's log4j. it totally rocks, I use it here at work. I've never had problems with tomcat not pushing data out...could you put up a small sample of the code that's not printing out (and do you know that execution is reaching that code?)

Ethan 05-29-2002 08:47 PM

I took a look at the log4j site. Looks extremely cool. I'll try to experiment with it when I have a chance.

Someone on another forum said that in Tomcat 4.0.1, the standard output goes to the file logs/catalina.out. And indeed, I found the output from my print statements there. I'm not sure why they set it up that way. I guess servlets operate in their own isolated universe within Tomcat.

Maybe there's a way to change that behavior. I found no reference to "output" or "catalina.out" in conf/server.xml.



jISV 05-30-2002 12:02 PM

I'm using 4.0.1 and my printlines go to stdout - not to Catalina.out

I've changed nothing at all from the default zip extraction - this is on winblows mind you. Still, I can't see it would be different on linux.

Yarrick 06-03-2002 10:35 AM

out.println() prints to the webpage, System.out.println() prints to the log.

uuutino 07-23-2002 06:40 PM

Is there anyway to see System.out.println() messages in some kind of window that keeps on getting updates instead of having to open the log file everytime to see updates?


orgcandman 07-24-2002 09:24 AM

if you're running on a *nix machine, run less or tail -f on the log file. If you're on a Micros**t machine, download cygwin and use less or tail -f ;)


uuutino 07-24-2002 12:40 PM

Cool! Thanks for the prompt response. However, is there a way to direct the message to the screen (and not a log file) and have it update automatically? (therefore it doens't take up space on the hd and i won't need to type anything to see the latest information)


All times are GMT -5. The time now is 03:29 AM.