Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Program output can be difficult to trace and may be jumbled with Maven logs when running Maven with multiple threads #152

Closed
hankolerd opened this issue May 21, 2020 · 1 comment · Fixed by ThePrez/ServiceCommander-IBMi#18
Milestone

Comments

@hankolerd
Copy link
Contributor

hankolerd commented May 21, 2020

A common problem I have faced when working on large projects that run with large thread counts is that the executed program output can be hard to identify with the Maven console output.

As an example, a simple Maven multi-module project where each project is executing:

<execution>
  <id>test</id>
  <phase>compile</phase>
  <goals>
    <goal>exec</goal>
  </goals>
  <configuration>
    <executable>bash</executable>
    <arguments>
      <argument>-c</argument>
      <argument><![CDATA[
        for i in {1..10000}
        do
          echo "${project.artifactId} - $i"
        done
      ]]></argument>
    </arguments>
  </configuration>
</execution>

The Maven console output may come as:

[BuilderThread 1] [INFO] --- exec-maven-plugin:1.6.0:exec (test) @ module1 ---
[BuilderThread 2] [INFO] --- exec-maven-plugin:1.6.0:exec (test) @ module2 ---
...
module2 - 98
modu
module1 - 97
module1 -
le2 - 9899
...

It would be great to have an option (or maybe even make it the default behavior) to redirect program output into the Maven logger, so that we can trace the program output within a specific build thread, and so that log output is synchronized to avoid jumbled output. For the example above, the preferred output would be something more similar to:

[BuilderThread 1] [INFO] --- exec-maven-plugin:1.6.0:exec (test) @ module1 ---
[BuilderThread 2] [INFO] --- exec-maven-plugin:1.6.0:exec (test) @ module2 ---
...
[BuilderThread 2] [INFO] module2 - 98
[BuilderThread 1] [INFO] module1 - 97
[BuilderThread 1] [INFO] module1 - 98
[BuilderThread 2] [INFO] module2 - 99
...
@hankolerd
Copy link
Contributor Author

I opened pull request #153 as a suggested patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants