Console: error msg interspersed with normal output

Answered

Hi,

Using IJ Idea 12.0.4 on Xubuntu x64, Sun JDK 1.6.39. I made a small console demo that displays a few lines lines using System.out.printf(). Let's assume the very last line of the program cause an exception. In the console, the text of the normal output is interspersed with the red error messages from the runtime error. As a result, it is very confusing as I cannot know after which printf() the runtime error occurred. Can you please confirm?

Basically the console currently look like that:

Normal printf() Line1
Exception in thread "main" java.lang.IllegalArgumentException: blabla...
Normal printf() Line2
at com.bogus.testIJ.ClockDemo.setTime(ClockDemo.java:29)
at com.bogus.testIJ.ClockDemoTest.main(ClockDemoTest.java:43)
Normal printf() Line3
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Normal printf() Line4
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
Normal printf() Line5. This program finishes with an intentional exception below.

I would expect the console output to be:

Normal printf() Line1
Normal printf() Line2
Normal printf() Line2
Normal printf() Line2
Normal printf() Line5. This program finishes with an intentional exception below.
Exception in thread "main" java.lang.IllegalArgumentException: blabla...
at com.bogus.testIJ.ClockDemo.setTime(ClockDemo.java:29)
at com.bogus.testIJ.ClockDemoTest.main(ClockDemoTest.java:43)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

7 comments
Comment actions Permalink

Hi Ralph,

That is a known problem - stdout and stderr output is mixed - IDEA-70016.

Denis

0
Comment actions Permalink

That is a known problem - stdout and stderr output is mixed - IDEA-70016.

Look like it's a long standing issue. Can you please suggest a work around?

0
Comment actions Permalink

Unfortunately, no workaround is available at the moment

Denis

0
Comment actions Permalink

So sad that problem is not solved after some years... :(

0
Comment actions Permalink

This is a serious issue, wonder why it hasn't been fixed yet.

 

0
Comment actions Permalink

PyCharm also has this problem, which I believe uses the same IDE engine. There's a fix if you add the following line to your idea.properties file:

output.reader.blocking.mode=true

This file resides beside the pycharm.exe. In my case C:\Program Files\JetBrains\PyCharm 2018.3.5\bin\ contains the idea.properties file.

Edit: as Serge Baranov says, it's best to create a user-defined custom `idea.properties` via Help | Edit Custom Properties.
1
Comment actions Permalink

The best way to edit IDE properties is via Help | Edit Custom Properties.

1

Please sign in to leave a comment.