system.out.println() not working in servlet, Tomcat
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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?)
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.
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?
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)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.