Skip to content

Added logging message for tasks that fail without error#8125

Merged
benvillalobos merged 5 commits intodotnet:mainfrom
edvilme:main
Nov 8, 2022
Merged

Added logging message for tasks that fail without error#8125
benvillalobos merged 5 commits intodotnet:mainfrom
edvilme:main

Conversation

@edvilme
Copy link
Copy Markdown
Contributor

@edvilme edvilme commented Nov 3, 2022

Fixes #6633

Context

Changes Made

Added check for tasks that fail without error messages, so that a normal priority message is shown.

Testing

Extended existing tests to validate new behavior. Also validated that in dotnet test scenarios, the new message is not visible.

Notes

@dnfadmin
Copy link
Copy Markdown

dnfadmin commented Nov 3, 2022

CLA assistant check
All CLA requirements met.

@edvilme
Copy link
Copy Markdown
Contributor Author

edvilme commented Nov 3, 2022

image
This is how the message gets logged in the binlog in a failing dotnet test.

// If is allowed to fail without error
if (be is IBuildEngine7 be7 && be7.AllowFailureWithoutError)
{
taskLoggingContext.LogComment(MessageImportance.Normal, "TaskReturnedFalseButDidNotLogError", _taskNode.Name);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Fit-and-finish question (@baronfel, especially): This logs with the MSB4181: prefix. Generally, we try not to have "error codes" for message-level logging. But here, it's kind of a warning, if you squint really hard. Should we strip the prefix, or leave it as-is?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The normal case is hopefully non-error (they rerouted the error(s) appropriately, so it's just an informational message they don't care about). Most of our other messages are similar to this in that they might indicate an error but usually don't, so I'd vote for stripping the prefix, personally, but it's reasonable to leave it to baronfel.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Most of our other messages are similar to this in that they might indicate an error but usually don't

I don't think I agree with this. We have a lot of messages that are fully neutral like "Started building target", and that feels like a very solid majority of logging in a normal build to me.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think of your example as "might indicate an error but usually don't"; if that target should not be building (or should not be building yet), it's indicating an error...but it's normally innocuous.

edvilme and others added 3 commits November 3, 2022 14:56
Specific version was added to avoid conflicts with newest internal version of dotnet and VS. Removed for PR
Co-authored-by: Rainer Sigwald <raines@microsoft.com>
// If is allowed to fail without error
if (be is IBuildEngine7 be7 && be7.AllowFailureWithoutError)
{
taskLoggingContext.LogComment(MessageImportance.Normal, "TaskReturnedFalseButDidNotLogError", _taskNode.Name);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The normal case is hopefully non-error (they rerouted the error(s) appropriately, so it's just an informational message they don't care about). Most of our other messages are similar to this in that they might indicate an error but usually don't, so I'd vote for stripping the prefix, personally, but it's reasonable to leave it to baronfel.

// If is allowed to fail without error
if (be is IBuildEngine7 be7 && be7.AllowFailureWithoutError)
{
taskLoggingContext.LogComment(MessageImportance.Normal, "TaskReturnedFalseButDidNotLogError", _taskNode.Name);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Most of our other messages are similar to this in that they might indicate an error but usually don't

I don't think I agree with this. We have a lot of messages that are fully neutral like "Started building target", and that feels like a very solid majority of logging in a normal build to me.

@Forgind Forgind added the merge-when-branch-open PRs that are approved, except that there is a problem that means we are not merging stuff right now. label Nov 7, 2022
@benvillalobos benvillalobos merged commit 9e51098 into dotnet:main Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-when-branch-open PRs that are approved, except that there is a problem that means we are not merging stuff right now.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Should still log a message even if AllowFailureWithoutError is set

5 participants