Try flushing or something equivalent

On Tue, Jun 22, 2021, 10:44 Alex Orlov <ooo_satu...@mail.ru.invalid> wrote:

>
> Hi all,
>
> I use JPMS test modules and for debugging I use the following command:
> mvn -Dmaven.failsafe.debug="-Xdebug
> -Xrunjdwp:transport=dt_socket,server=y,suspe=y,address=8000 -Xnoagent
> -Djava.compiler=NONE" clean verify -P it
>
> So, all tests are executed in child process. However, there is one
> problem. When tests are executed in child process
> then messages are printed on console only after test is executed. But, I
> need to see messages during debugging immediately.
> As I found out messages are printed on console after the following code in
>  org.apache.maven.surefire.booter.spi.LegacyMasterProcessChannelEncoder
>
>     private void encodeAndPrintEvent( StringBuilder event, boolean
> sendImmediately )
>     {
>         try
>         {
>             //noinspection ResultOfMethodCallIgnored
>             Thread.interrupted();
>             byte[] array = event.append( '\n' )
>                 .toString()
>                 .getBytes( STREAM_ENCODING );
>             ByteBuffer bb = ByteBuffer.wrap( array );
>             if ( sendImmediately )
>             {
>                 out.write( bb );   <========================== AFTER THIS
> LINE
>             }
>             else
>             {
>                 out.writeBuffered( bb );
>             }
>         }
>         catch ( ClosedChannelException e )
>         {
>             if ( !onExit )
>             {
>                 DumpErrorSingleton.getSingleton()
>                     .dumpException( e, "Channel closed while writing the
> event '" + event + "'." );
>             }
>         }
>     …..
>     }
>
> Could anyone sat if there is any solution/flag to print log messages from
> child process on console immediately?
>
>
>
> --
> Best regards, Alex Orlov
>

Reply via email to