Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tomcat STDOUT as Error in Eclipse

Tags:

I am configuring Tomcat (5.5) server in Eclipse (3.3.2). Once I add Tomcat and start it, the output is printed in Eclipse Console. This output is printed in RED indicating its Standard Error. Although the server gets started without any error the normal INFO is also marked as error.

Jul 29, 2010 7:06:14 PM org.apache.catalina.core.AprLifecycleListener init INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.5.0_10\bin;.;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\Java\jdk1.5.0_10\bin\..\jre\bin\client;C:\Program Files\Java\jdk1.5.0_10\bin\..\jre\bin;C:\Program Files\CollabNet Subversion Client;C:\Program Files\Java\jdk1.5.0_10\bin;C:\Program Files\Java\jre1.5.0_07\bin;C:\Program Files\Oracle\Oracle9i\9201\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Sybase125\OCS-12_5\bin;C:\Program Files\Sybase125\OCS-12_5\dll;C:\Program Files\Sybase125\OLEDB;C:\Program Files\Rational\ClearCase\bin;C:\Program Files\Ubsw\Wire\Core;Z:\ZUR_GCOMP_DOC\Project_Trust\datamodel\scripts\GC_trust\Release\1.36\01-DDL;K:\scripts\;C:\Program Files\Ubsw\Wire\Core\;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Windows Imaging\;C:\Program Files\MySQL\MySQL Server 5.1\bin;C:\Program Files\apache-maven-2.2.1\bin;C:\Program Files\apache-ant-1.7.0\bin;C:\Viral\Tech\Java\javadb/bin;C:\Program Files\JAD Jul 29, 2010 7:06:15 PM org.apache.coyote.http11.Http11BaseProtocol init INFO: Initializing Coyote HTTP/1.1 on http-8080 Jul 29, 2010 7:06:15 PM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 1187 ms Jul 29, 2010 7:06:15 PM org.apache.catalina.core.StandardService start INFO: Starting service Catalina Jul 29, 2010 7:06:15 PM org.apache.catalina.core.StandardEngine start INFO: Starting Servlet Engine: Apache Tomcat/5.5.30 Jul 29, 2010 7:06:15 PM org.apache.catalina.core.StandardHost start INFO: XML validation disabled Jul 29, 2010 7:06:15 PM org.apache.coyote.http11.Http11BaseProtocol start INFO: Starting Coyote HTTP/1.1 on http-8080 Jul 29, 2010 7:06:15 PM org.apache.jk.common.ChannelSocket init INFO: JK: ajp13 listening on /0.0.0.0:8009 Jul 29, 2010 7:06:15 PM org.apache.jk.server.JkMain start INFO: Jk running ID=0 time=0/110  config=null Jul 29, 2010 7:06:15 PM org.apache.catalina.storeconfig.StoreLoader load INFO: Find registry server-registry.xml at classpath resource Jul 29, 2010 7:06:15 PM org.apache.catalina.startup.Catalina start INFO: Server startup in 922 ms 

Can anyone let me know how to overcome this and change the output back to BLACK as STDOUT?

like image 295
Viral Patel Avatar asked Jul 29 '10 17:07

Viral Patel


People also ask

How do I fix the unknown version of tomcat was specified in eclipse?

The Best Answer is You are specifying tomcat source directory. You need to specify tomcat binary installation root directory, also known as CATALINA_HOME. Usually, this is where you untar apache-tomcat-7.0. 42.

How can I add tomcat server to eclipse?

For configuring the tomcat server in eclipse IDE, click on servers tab at the bottom side of the IDE -> right click on blank area -> New -> Servers -> choose tomcat then its version -> next -> click on Browse button -> select the apache tomcat root folder previous to bin -> next -> addAll -> Finish.

Where does system out Println go in tomcat?

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.


1 Answers

It's in red because it's written to standard error (System.err), assuming you're using a normal configuration.

Theoretically, the way to fix this is to adjust the logging configuration (which appears to be java.util.logging based) so that messages at INFO level and below are written to standard out instead. Unfortunately, this is a little bit messier than it might be because the ConsoleHandler class is hard-coded to write to standard error, and if you mix between writing to standard out and standard error, there's a good chance that you'll end up getting the logging messages written out of order. (That's bad. Very confusing.) You could fix it by subclassing StreamHandler and doing a lot of fiddling around – e.g., override publish so it sets the output stream if logging changes from high-level to low-level or vice versa – but I really doubt that the results are going to be what you desire. It's also going to be slow.

Since in a production deployment of Tomcat you don't log to the console anyway (it logs to files by default) I suggest stopping worrying about this.

like image 191
Donal Fellows Avatar answered Oct 07 '22 01:10

Donal Fellows