|Re: Eclipse + Tomcat Apache + Console Output [message #531995 is a reply to message #531848]
||Thu, 06 May 2010 17:36
| Larry Isaacs
Registered: July 2009
> Hi guys,
> Using the latest version of Eclipse for Java Enterprise on Windows XP
> and I have Tomcat Apache 6.0.26 installed. When I start the server the
> console output (all INFO) is printed in red.
> I have been told to change the Console colour settings under Preferences
> from red to black for Standard Error text color.
> If i change that, then console output is now black but calling
> System.out.print is output in red.
> This also happens when I use log4j.
> So surely there must be something I missed in either my Tomcat Apache
> configuration or Log4j config.
> logger.error() is printed in black and logger.info() is printed in red.
> any ideas why?
> System.out and System.err behave as expected.
> I have googled a lot and was not able to find a proper answer.
> Thanks for your help.
Note that Tomcat 5.5.x doesn't do this, so this behavior would seem to
be caused by something different within Tomcat 6.0.26.
For JULI logging, what is different is when logging gets initialized.
In Tomcat 6.0.x, the java.util.logging.ConsoleHandler (which outputs to
System.err) gets initialized early and outputs to the original
System.err. Later in Tomcat 6.2.x startup, System.out and System.err
are replaced with a SystemLogHandler that outputs to the original
System.out. I believe this helps with the per webapp logging features
of Tomcat. This accounts for the red and black for Tomcat 6.0.x. It
may be a similar issue for Log4J.
In Tomcat 5.5.x using JULI, the System.out and System.err replacement
occurs first, so ConsoleHandler outputs to the replaced System.err which
eventually goes to the original System.out. What this means is that you
don't have access to the original System.out and System.err as Tomcat
takes control of them first.
Powered by FUDForum
. Page generated in 0.03083 seconds