File tree 1 file changed +8
-5
lines changed
src/main/java/org/codehaus/mojo/exec 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -452,8 +452,11 @@ else if ( !StringUtils.isEmpty( argsProp ) )
452
452
else if (useMavenLogger )
453
453
{
454
454
getLog ().debug ("Will redirect program output to Maven logger" );
455
- final String parentThreadName = Thread .currentThread ().getName ();
456
- final String logSuffix = "[" + parentThreadName + "] " ;
455
+ // If running parallel, append the projects original (i.e. current) thread name to the program
456
+ // output as a log prefix, to enable easy tracing of program output when intermixed with other
457
+ // Maven log output. NOTE: The accept(..) methods are running in PumpStreamHandler thread,
458
+ // which is why we capture the thread name prefix here.
459
+ final String logPrefix = session .isParallel () ? "[" + Thread .currentThread ().getName () + "] " : "" ;
457
460
Consumer <String > mavenOutRedirect = new Consumer <String >()
458
461
{
459
462
@@ -462,11 +465,11 @@ public void accept(String logMessage)
462
465
{
463
466
if (quietLogs )
464
467
{
465
- getLog ().debug (logSuffix + logMessage );
468
+ getLog ().debug (logPrefix + logMessage );
466
469
}
467
470
else
468
471
{
469
- getLog ().info (logSuffix + logMessage );
472
+ getLog ().info (logPrefix + logMessage );
470
473
}
471
474
}
472
475
};
@@ -476,7 +479,7 @@ public void accept(String logMessage)
476
479
@ Override
477
480
public void accept (String logMessage )
478
481
{
479
- getLog ().error (logSuffix + logMessage );
482
+ getLog ().error (logPrefix + logMessage );
480
483
}
481
484
};
482
485
You can’t perform that action at this time.
0 commit comments