You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "psiroky (via GitHub)" <gi...@apache.org> on 2023/03/09 17:50:44 UTC

[GitHub] [maven-mvnd] psiroky commented on issue #789: Surefire [INFO] output lines do not get prefixed with module name in batch mode

psiroky commented on issue #789:
URL: https://github.com/apache/maven-mvnd/issues/789#issuecomment-1462497519

   I noticed the same behavior the other day, so I gave it a quick look. It seems like surefire is creating it's own background thread to log some of the messages. See https://github.com/apache/maven-surefire/blob/surefire-3.0.0-M9/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/output/ThreadedStreamConsumer.java#L123.
   
   If I understand correctly, `mvnd` is storing the `artifactId` via SLF4J's MDC (https://github.com/apache/maven-mvnd/blob/0.9.0/daemon/src/main/java/org/mvndaemon/mvnd/logging/smart/ProjectBuildLogAppender.java#L59), and since surefire creates new thread, the MDC from `BuilderThread` is lost.
   
   I am not sure about a proper fix here and I am currently not able to figure a way to fix this directly in mvnd. The only fix I can think of is to change surefire to propagate the MDC of the parent thread (e.g. `MDC.setContextMap(ctx)`) -- assuming there are not any negative consequences.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org