dotnet / dotnet/msbuild

Affordance in tasks for promoting log spew priority on failure

Open
#3,056 0 comments 0 reactions 0 assignees View on GitHub
Area: Debuggability Feature Request needs-design triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

Often, a tool invoked during a build will be somewhat chatty: it logs progress or details of its processing that is only interesting if you really want to drill into its internals or on error. Logging all standard output as low priority (the [ToolTask default](https://github.com/Microsoft/msbuild/blob/f172b9afbec5e9187a59eba6ec9b0bd2bf3fb082/src/Utilities/ToolTask.cs#L374-L377)) handles the first case: you can always rebuild with a higher MSBuild verbosity.

In error cases, though, it would often be nice to be able to retroactively promote log statements to a higher level. Then a successful task invocation would result in a quiet build at normal or minimal verbosity, but a _failed_ build would log the process output as well as any errors even at low verbosity.

We could accumulate outputs and only log them after knowing the overall task result, but that doesn't seem like a very good idea here. It'd require potentially unbounded memory, but a bigger problem with doing this in MSBuild is that we generally fire log events as we receive output (one per line), and the task doesn't keep a record of what it has emitted in the past. We wouldn't want to lose the semi-synchronous nature of logging to get this--it's nice to be able to see (appropriately prioritized) messages emitted from tasks as they're ready.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.