You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "scottrw93 (via GitHub)" <gi...@apache.org> on 2026/01/15 18:12:55 UTC
[PR] Pass slf4j context to spawned thread [maven-surefire]
scottrw93 opened a new pull request, #3241:
URL: https://github.com/apache/maven-surefire/pull/3241
### Details
For https://github.com/apache/maven-surefire/issues/2687
Now you have moved to slf4j it would be nice to pass the slf4j mdc context from parent thread to the threads spawned by `ThreadedStreamConsumer`. The context is really useful for custom logging implementations in maven as when running in parallel mode it lets you do things like prefix the log line with the module name that generated it or grouping all logs by the module and printing them sequentially at the end of the build.
The best example of this is in [mvnd](https://github.com/apache/maven-mvnd/issues/789) where they prefix each log line with the module, but it doesn't work for surefire as the logging context is logged in the new thread. If multiple modules are running test at once its not clear which one generated the log line.
```
[maven-artifact] [INFO]
[maven-artifact] [INFO] -------------------------------------------------------
[maven-artifact] [INFO] T E S T S
[maven-artifact] [INFO] -------------------------------------------------------
[maven-slf4j-provider] [INFO] Enabled default license matchers.
[maven-slf4j-provider] [INFO] Will parse SCM ignores for exclusions...
[maven-slf4j-provider] [INFO] Finished adding exclusions from SCM ignore files.
[maven-slf4j-provider] [INFO] 62 implicit excludes (use -debug for more details).
[maven-slf4j-provider] [INFO] 18 explicit excludes (use -debug for more details).
[maven-slf4j-provider] [INFO] 7 resources included (use -debug for more details)
[INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.027 s - in org.apache.maven.model.CiManagementTest
[INFO] Running org.apache.maven.model.ReportingTest
[INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.035 s - in org.apache.maven.model.ReportingTest
[INFO] Running org.apache.maven.model.ScmTest
```
### Checklist
Following this checklist to help us incorporate your
contribution quickly and easily:
- [x] Each commit in the pull request should have a meaningful subject line and body.
- [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
- [x] Run `mvn clean install` to make sure basic checks pass. A more thorough check will
be performed on your pull request automatically.
- [ ] You have run the integration tests successfully (`mvn -Prun-its clean install`).
If your pull request is about ~20 lines of code you don't need to sign an
[Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure
please ask on the developers list.
To make clear that you license your contribution under
the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
you have to acknowledge this by using the following check-box.
- [x] I hereby declare this contribution to be licenced under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
- [ ] In any other case, please file an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
--
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
Re: [PR] Pass slf4j context to spawned thread [maven-surefire]
Posted by "olamy (via GitHub)" <gi...@apache.org>.
olamy merged PR #3241:
URL: https://github.com/apache/maven-surefire/pull/3241
--
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
Re: [PR] Pass slf4j context to spawned thread [maven-surefire]
Posted by "scottrw93 (via GitHub)" <gi...@apache.org>.
scottrw93 commented on PR #3241:
URL: https://github.com/apache/maven-surefire/pull/3241#issuecomment-3789586951
Anyone able to take a look at this?
--
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
Re: [PR] Pass slf4j context to spawned thread [maven-surefire]
Posted by "scottrw93 (via GitHub)" <gi...@apache.org>.
scottrw93 commented on PR #3241:
URL: https://github.com/apache/maven-surefire/pull/3241#issuecomment-3805800010
I cleaned up the imports that caused spotless checks to fail.
--
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
Re: [PR] Pass slf4j context to spawned thread [maven-surefire]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #3241:
URL: https://github.com/apache/maven-surefire/pull/3241#issuecomment-3844702955
@olamy Please assign appropriate label to PR according to the type of change.
--
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
Re: [PR] Pass slf4j context to spawned thread [maven-surefire]
Posted by "scottrw93 (via GitHub)" <gi...@apache.org>.
scottrw93 commented on PR #3241:
URL: https://github.com/apache/maven-surefire/pull/3241#issuecomment-3834273904
All the checks have passed, does this look ok to merge?
--
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