microsoft / MSBuildSdks

MSBuild project SDKs
MIT License
449 stars 80 forks source link

[CopyOnWrite] duplicate file copy message #537

Closed KirillOsenkov closed 6 months ago

KirillOsenkov commented 6 months ago

In the CopyOnWrite SDK, for every file copy I'm seeing two messages:

image

Isn't one redundant? I'd remove the one that says CloneFile (to keep the behavior identical with the in-the-box copy task)

KirillOsenkov commented 6 months ago

@erikmav

KirillOsenkov commented 6 months ago

This becomes a problem for huge builds and 100,000 file copies (only logging a single message significantly reduces the log size)

KirillOsenkov commented 6 months ago

In general keeping the messages as close to the original task as possible is important because there are tools and analyzers that do things like double-write detection, etc. by parsing the copy messages.

erikmav commented 6 months ago

You must be slightly behind the latest package version (1.0.302 is latest). Current text output at low importance looks like:

Log.LogMessage(MessageImportance.Low, $"Created copy-on-write link '{sourceFullPath}' to '{destFullPath}'.");

I assume your build is emitting verbose logs?

Options I can see:

  1. Remove the extra trace. I don't like it because you then can't tell if a CoW link was created at all. However with CoW-in-Win32 (built into Windows) on the horizon for this fall, after which I'll deprecate the CoW SDK, we'd be back to the original MSBuild version of Copy that would also not have that trace statment.
  2. Generate one output trace but change from 'Copying...' to one of 'Copied' or 'Cloned'. That would break the logfile scanning you mentioned however.

Thoughts?

KirillOsenkov commented 6 months ago

I'm looking at binary logs which record everything.

Indeed, on the latest version I do get Copying file from and Created copy-on-write link.

Let's leave it as is then, because I agree, Created copy-on-write link is important to know, and we need to keep the Copying message for analysis.