Java.Util.Logging Color Output in IDE

S

Symz

Hi comp.java

Can someone please explain the different colors I see in my Eclipse console
when I use java.util.logging. Also, how does one configure this? I seem to
recall this happening in JDeveloper as well so I assume this is a logging
feature and would like to use it properly.

I have a straight forward property file in both a Tomcat and normal console
based app. The color for the Tomcat app output is blue regardless of level
and red for the console app (regardles of level).

I can't seem to google effectlively to get the answer.

Apologies if this is the wrong newsgroup.
 
R

Roland

Hi comp.java

Can someone please explain the different colors I see in my Eclipse console
when I use java.util.logging. Also, how does one configure this? I seem to
recall this happening in JDeveloper as well so I assume this is a logging
feature and would like to use it properly.

I have a straight forward property file in both a Tomcat and normal console
based app. The color for the Tomcat app output is blue regardless of level
and red for the console app (regardles of level).

I can't seem to google effectlively to get the answer.

Apologies if this is the wrong newsgroup.

The Eclipse output console renders output to System.out in blue, and
output to System.err in red. Keyboard input for System.in is rendered in
green. It further somehow parses the output to make class references in
a stack trace act as a hyperlink (so a click shows the source at the
proper line number).

IIRC, the default console handler of java.util.logging prints messages
to System.err, and therefor Eclipse renders them red. Maybe Tomcat logs
its messages to System.out (rendered blue).
--
Regards,

Roland de Ruiter
___ ___
/__/ w_/ /__/
/ \ /_/ / \
 
S

Symz

Aha.

" IIRC, the default console handler of java.util.logging prints messages
to System.err, and therefor Eclipse renders them red. Maybe Tomcat logs
its messages to System.out (rendered blue)."

That rings a bell. Out of interest, do you know how to go to redirect
System.err to System.out for java.util.logging?

Thanks Roland,

Cheers Simon.
 
R

Roland

The Eclipse output console renders output to System.out in blue, and
output to System.err in red. Keyboard input for System.in is rendered in
green. It further somehow parses the output to make class references in
a stack trace act as a hyperlink (so a click shows the source at the
proper line number).

IIRC, the default console handler of java.util.logging prints messages
to System.err, and therefor Eclipse renders them red. Maybe Tomcat logs
its messages to System.out (rendered blue).

Another addition: the colors are IDE specific. In Eclipse 3.0 they can
be configured in Window -> Preferences -> Run/Debug -> Console.


--
Regards,

Roland de Ruiter
, ___ ___
/__/ w_/ /__/
/ \ /_/ / \
 
S

Symz

That rings a bell. Out of interest, do you know how to go to redirect
System.err to System.out for java.util.logging?

Only seems possible if you subclass the consolehandler and set the stream
via the protected setOutputStream method, like

class myConsoleHandler extends ConsoleHandler {
public myConsoleHandler() {
super();
this.setOutputStream(System.out);
}
}

Any other suggestions?
 
T

tzvika.barenholz

not to be the smartass, but just use log4j and define the appenders as
you like them
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,990
Messages
2,570,211
Members
46,796
Latest member
SteveBreed

Latest Threads

Top