23

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?

Viral Patel
  • 8,506
  • 3
  • 32
  • 29

5 Answers5

14

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.

Donal Fellows
  • 133,037
  • 18
  • 149
  • 215
  • Would this do it? http://stackoverflow.com/questions/194165/how-do-i-change-java-logging-console-output-from-std-err-to-std-out and who would one use that with Tomcat? – Sam Hasler Feb 12 '15 at 09:22
3

There is a short answer to your question :

Right clic in Console view > Preferences...

and then set "Standard Error text color" to black.

But of course, it would be better if Eclipse knew that Tomcat server log is not to be shown in red.

It looks like there are no better answers for now : http://www.eclipse.org/forums/index.php?t=msg&goto=531848&

The problem can be reproduced with Tomcat 6 and Tomcat 7 in Eclipse 3.6.2

Tristan
  • 8,733
  • 7
  • 48
  • 96
1

The following has worked for me.

In the Tomcat server.xml, comment out

<Listener SSLEngine="on" className="org.apache.catalina.core.AprLifecycleListener"/>

Seems like the "red is caused" by Tomcat not be able to load the APR native lib. Skip the loading and no more red.

Marc
  • 3,243
  • 3
  • 23
  • 26
  • 1
    Tried this and it didn't work. I've also configured the APR native lib to load correctly and that didn't change anything either. – Sam Hasler Apr 24 '14 at 15:48
  • @SamHasler I noticed the issue happens whenever Tomcat emits any kind of error or warning. Do you see anything else? – Marc Apr 25 '14 at 23:41
0

For me it was some other error. It helped, when I made sure, no errors (only infos) where in the start up log. Apparently tomcat switches to error output if it encounters an error.

funql.org
  • 81
  • 4
0

Yep, the java.util.logging.ConsoleHandler publishes to System.err (and not to the System.out)...

A workaround that does not involve coding, or just masking any possible error in black is to add to the VM arguments in the eclipse launch configuration:

 -Djava.util.logging.config.file="${workspace_loc}\Servers\Tomcat v8.5 Server at localhost-config\logging.properties"

(adjust the server config folder accordingly)

and create the logging.properties with:

.level=WARNING

This way only problems or potential problems will show in the console, but in red, the fitting color.

João
  • 2,296
  • 5
  • 20
  • 30