LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-29-2002, 02:30 PM   #1
Ethan
Member
 
Registered: Mar 2002
Location: California, USA
Posts: 41

Rep: Reputation: 15
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?

Thanks,

Ethan
 
Old 05-29-2002, 02:46 PM   #2
orgcandman
Member
 
Registered: May 2002
Location: new hampshire
Distribution: Fedora, RHEL
Posts: 600

Rep: Reputation: 110Reputation: 110
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?)
 
Old 05-29-2002, 07:47 PM   #3
Ethan
Member
 
Registered: Mar 2002
Location: California, USA
Posts: 41

Original Poster
Rep: Reputation: 15
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.

Thanks,

Ethan
 
Old 05-30-2002, 11:02 AM   #4
jISV
Member
 
Registered: Feb 2002
Location: England
Distribution: MDK8.2
Posts: 128

Rep: Reputation: 15
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.
 
Old 06-03-2002, 09:35 AM   #5
Yarrick
LQ Newbie
 
Registered: May 2002
Distribution: Gentoo 1.1a
Posts: 2

Rep: Reputation: 0
out.println() prints to the webpage, System.out.println() prints to the log.
 
Old 07-23-2002, 05:40 PM   #6
uuutino
LQ Newbie
 
Registered: Jul 2002
Posts: 2

Rep: Reputation: 0
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?

Thanks
 
Old 07-24-2002, 08:24 AM   #7
orgcandman
Member
 
Registered: May 2002
Location: new hampshire
Distribution: Fedora, RHEL
Posts: 600

Rep: Reputation: 110Reputation: 110
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

Aaron
 
Old 07-24-2002, 11:40 AM   #8
uuutino
LQ Newbie
 
Registered: Jul 2002
Posts: 2

Rep: Reputation: 0
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)

thanks!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
println question AMMullan Programming 2 04-18-2004 07:38 AM
TOMCAT init script not working on startup -- tomcat 4.x / Mandrake Linux 8.0 jmartinph Mandriva 0 03-08-2004 01:31 AM
install Java (Servlet), Tomcat on Fedora need help. learn Fedora 2 02-24-2004 11:28 PM
how can i run my helloworld servlet in apache-tomcat-mod_jk? doublefailure Linux - Software 1 04-28-2003 08:33 AM
To have 'tomcat' up upon system boot up ... t0dd Linux - Software 1 03-10-2002 01:33 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration