Where do messages sent to System.err go when using Tomcat externally to run a web app from IntelliJ?
Asked Answered
A

1

1

I am using IntelliJ 2019.3 Ultimate edition IDE to run my Vaadin web app through Apache Tomcat web container.

When a message goes out to System.err such as:

System.err.println( "My message goes here." ) ;

…where does that message land?

On the console displayed within IntelliJ I see message appear that I sent to System.out. But message sent to System.err fail to appear on that same console.

Angelus answered 2/12, 2019 at 3:45 Comment(1)
A
0

Check that console again

The messages should indeed appear in the same console within IntelliJ.

You may not have noticed for a couple of reasons: color, and order.

Colorized

Beware of coloring. Given that the err in System.err means “error”, IntelliJ colorizes such messages as red ink.

Vaadin generates much text in various colors. Your eye may be skipping over those colored blocks, looking for other colors (such as white ink on black background in in dark mode).

Click to zoom the screenshot below created by this code:

System.out.println( "BASIL sout - " + message );
System.err.println( "BASIL System.err message" );

Notice lines 3 & 5.

  • Line 3 in red is from call to System.err.
  • Line 5 in white is from call to System.out.

(Line 4 is from a call made to the Simple implementation of SLF4 logging framework, and is irrelevant here.)

Screenshot of console in IntelliJ in dark mode, showing System.err messages as red text while System.out messages use white text.

Out-of-order appearance

You may not have noticed your messages for another reason: They may arrive in the console in a different order than you called in your Java code.

See again in that screenshot above. Those lines 3 & 5 arrived out-of-order: Our second call in Java appeared first in the console output (I don’t know why).

Angelus answered 2/12, 2019 at 4:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.