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

[MNG-8605] The log file should be appended to #2137

Merged
merged 1 commit into from
Mar 4, 2025

Conversation

gnodet
Copy link
Contributor

@gnodet gnodet commented Mar 3, 2025

JIRA issue: MNG-8605

@gnodet gnodet added this to the 4.0.0-rc-3 milestone Mar 3, 2025
@gnodet gnodet changed the title The log file should be appended to [MNG-8605] The log file should be appended to Mar 3, 2025
@@ -231,7 +231,7 @@ private static OutputChoice computeOutputChoice(String logFile, boolean cacheOut
return new OutputChoice(cacheOutputStream ? OutputChoiceType.CACHED_SYS_OUT : OutputChoiceType.SYS_OUT);
} else {
try {
FileOutputStream fos = new FileOutputStream(logFile);
FileOutputStream fos = new FileOutputStream(logFile, true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

It's a log, the point is to get information, not to loose it. If you don't need the log, just remove it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem I had was debugging a test in mvnd which runs Maven twice in a row. It took me some time to find out why I only had the output of the second run in the log...
No big deal though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, this sounds like a mvnd problem, not?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So mvnd uses the Constants.MAVEN_LOGGER_LOG_FILE constant to make sure the daemon log is redirected to disk, see https://github.com/apache/maven-mvnd/blob/db22a0a31bdcb000542a80c7d0ec491eab77f0bf/client/src/main/java/org/mvndaemon/mvnd/client/DaemonConnector.java#L437-L438

This means that only the last execution for a given daemon will be logged. I don't really see that as an intuitive behavior, as the daemon aims at being reused, so the log should not be erased imho. If you're not happy with changing the default, I'm fine with adding another property if you prefer. Note that in stock maven, this property is actually mostly useless, as it's being circumvented by another mechanism (you need a custom ProjectBuildLogAppender to get around that, such as in mvnd).

@gnodet gnodet merged commit af4debc into apache:master Mar 4, 2025
13 checks passed
@michael-o
Copy link
Member

You didn't even leave time to respond...😥

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

Successfully merging this pull request may close these issues.

3 participants