Skip to content

Don't log task inputs and outputs when binary logger is enabled#5498

Merged
jeffkl merged 3 commits intoNuGet:devfrom
KirillOsenkov:kirillo/nolog
Nov 15, 2023
Merged

Don't log task inputs and outputs when binary logger is enabled#5498
jeffkl merged 3 commits intoNuGet:devfrom
KirillOsenkov:kirillo/nolog

Conversation

@KirillOsenkov
Copy link
Copy Markdown
Contributor

@KirillOsenkov KirillOsenkov commented Nov 8, 2023

Stop logging task inputs and outputs now that the binary logger makes getting this information much easier.

This results in significant savings to binlog size and potentially faster restore as well (and less memory allocations).

Fixes NuGet/Home#10696

See related:

Bug

Fixes:

Regression? Last working version:

Description

PR Checklist

  • PR has a meaningful title

  • PR has a linked issue.

  • Described changes

  • Tests

    • Automated tests added
    • OR
    • Test exception - Only removed test assertions
    • OR
    • N/A
  • Documentation

    • Documentation PR or issue filled
    • OR
    • N/A

@KirillOsenkov KirillOsenkov requested a review from a team as a code owner November 8, 2023 19:39
@ghost ghost added the Community PRs created by someone not in the NuGet team label Nov 8, 2023
@KirillOsenkov
Copy link
Copy Markdown
Contributor Author

@jeffkl @nkolev92

@jeffkl
Copy link
Copy Markdown
Contributor

jeffkl commented Nov 9, 2023

@nkolev92 do you think these logging statements are useful anymore at all? Or can we just rely on the binary logger to have this information and remove the logging calls to these messages all together?

@jeffkl jeffkl self-assigned this Nov 9, 2023
@nkolev92
Copy link
Copy Markdown
Member

nkolev92 commented Nov 9, 2023

I think those messages may have lived out their usefulness now that binary logs are so common.

KirillOsenkov and others added 2 commits November 9, 2023 10:41
When binary logger is present, LogTaskInputs is set, so MSBuild automatically logs all inputs and outputs, there's no need to manually do so.

Starting with MSBuild 17.5 taskLogging.IsTaskInputLoggingEnabled is available, but we're still referencing Microsoft.Build.Utilities.v4.0.dll for net472 so it's not available. Instead of using reflection, just read the environment.

This results in significant savings to binlog size and potentially faster restore as well (and less memory allocations).

Fixes NuGet/Home#10696

See related:
 * dotnet/msbuild#6305
 * dotnet/msbuild#6803
@jeffkl
Copy link
Copy Markdown
Contributor

jeffkl commented Nov 9, 2023

I think those messages may have lived out their usefulness now that binary logs are so common.

Okay thanks, I agree. I've removed all task input/output logging

jeffkl
jeffkl previously approved these changes Nov 9, 2023

testLogger.Warnings.Should().Be(0);
testLogger.Errors.Should().Be(0);
testLogger.DebugMessages.Count.Should().Be(2);
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.

Should these be 0 instead of removing them completely?

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 don't think it matters unless we really care to ensure that a debug message isn't accidentally added. The code diff clearly shows that I removed the existing ones so it seems odd to me to check that they were removed. Do you feel strongly that we should update the test instead of remove this assertion?

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.

it's one of those that if I was writing the code originally, I would've changed it to 0.

I don't really have a strong reason to add it back though. I'm ok with it as is.

Copy link
Copy Markdown
Contributor Author

@KirillOsenkov KirillOsenkov left a comment

Choose a reason for hiding this comment

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

Looks great to me!

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

Labels

Community PRs created by someone not in the NuGet team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GetReferenceNearestTargetFrameworkTask should not log params when LogTaskInputs is set

4 participants