question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Commandline/object-model to inspect a binlog for errors/warnings

See original GitHub issue

A typical way in with file logs are used esp. in local/dev-builds goes like this:

$warn = Get-Content msbuild.wrn
$err = Get-Content msbuild.err 

if (warn.length -gt 0) {
    Write-Error "Warnings Found"
}

if (err.length -gt 0) {
    Write-Error "Errors Found"
}

I’m wondering if there is a simple way to replace file-logs with binary-logs for this type of scenario. Specifically, if there is a simple approach (for e.g., using powershell) to inspect a binary log for these (without replaying the log using msbuild - that would defeat the purpose of replacing file-logs with binary-logs):

  • Number of errors (or whether errors exist)
    • The error text
  • Number of warnings (or whether warnings exist)
    • The warning text

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
KirillOsenkovcommented, Jul 13, 2020

Hey @stephentoub @danmosemsft Vatsan has found an interesting scenario where reading a binlog takes 4 seconds on .NET Desktop, but 40 seconds on Core 3.1.

Repro:

  1. git clone https://github.com/vatsan-madhavan/MSBuildStructuredLogSummary
  2. msbuild /r
  3. Download the binlog from https://1drv.ms/u/s!Ah63gfGkKca4lsl2sy71gpkpM9TCog?e=ifgsMj and save it anywhere, e.g. C:\temp\vatsan\vatsan.binlog
  4. MSBuildBinLogSummary\bin\Debug\net472\MSBuildBinLogSummary.exe --log-file C:\temp\Vatsan\vatsan.binlog - takes 4 seconds
  5. MSBuildBinLogSummary\bin\Debug\netcoreapp3.1\MSBuildBinLogSummary.exe --log-file C:\temp\Vatsan\vatsan.binlog - takes 40 seconds

The stack that I saw was taking all the time is ReadByte from a GzipStream, it’s called millions of times (to read the binlog):

  | ZLibNative.ZLibStreamHandle.Inflate Line 300
-- | --
  | Inflater.Inflate Line 281
  | Inflater.ReadInflateOutput Line 266
  | Inflater.ReadOutput Line 122
  | Inflater.InflateVerified Line 92
  | Inflater.Inflate Line 55
  | DeflateStream.ReadByte Line 229
  | GZipStream.ReadByte Line 72
  | BinaryReader.ReadBoolean Line 236
  | BuildEventArgsReader.ReadTargetFinishedEventArgs Line 359
  | BuildEventArgsReader.Read Line 71
  | BinLogReader.Replay Line 78
  | BinLogReader.Replay Line 37
  | StructuredLoggerUtil..ctor Line 30
  | Program.ProcessBinaryLog Line 29
  | Program.Main Line 24

Is this something known? On Desktop Framework I see a similar native inflate stack, but it doesn’t cost nearly as much. Would someone be able to take a look? Thanks!

1reaction
KirillOsenkovcommented, Jul 12, 2020

Yes, try build.FindChildrenRecursive<Error> and build.FindChildrenRecursive<Warning>

Read more comments on GitHub >

github_iconTop Results From Across the Web

4.6.9 mysqlbinlog — Utility for Processing Binary Log Files
The server's binary log consists of files containing “events” that describe modifications to database contents. The server writes these files in binary ...
Read more >
Using MySQL BinLogs: A Detailed Guide
This blog explains using MySQL BinLogs & its operations in a simple way. It is a comprehensive guide on how to implement various...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found