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.

Quiet option to only print to console in case of error

See original GitHub issue

Steps to reproduce

Run dotnet restore --v:q or dotnet build --v:q.

Expected behavior

Do not print to console unless there are errors.

Actual behavior

Prints to console:

Restoring packages for /xxx/app.csproj...
Generating MSBuild file /xxx/
Generating MSBuild file /xxx/
Writing lock file to disk. Path: /xxx/
Restore completed in 998.62 ms for /xxx/
  
NuGet Config files used:
    /Users/lutzroeder/.nuget/NuGet/NuGet.Config
  
Feeds used:
    https://api.nuget.org/v3/index.json

Environment data

.NET Command Line Tools (1.0.1)

Product Information: Version: 1.0.1 Commit SHA-1 hash: 005db40cd1

Runtime Environment: OS Name: Mac OS X OS Version: 10.12 OS Platform: Darwin RID: osx.10.12-x64 Base Path: /usr/local/share/dotnet/sdk/1.0.1

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:11
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
vincentwoocommented, Sep 6, 2017

Seconded. That verbosity on quiet still prints pointless banner text is very odd:

root@64e3de0498da:~# dotnet build --verbosity q
Microsoft (R) Build Engine version 15.3.409.57025 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.


Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:01.31
1reaction
rainersigwaldcommented, Mar 27, 2020

@0xced fyi, that particular message is emitted by MSBuild and suppressible by -nologo since .NET Core SDK 1.0.

You can also disable the summary with -consoleLoggerParameters:NoSummary.

I’m going to close this issue. It’s not the default behavior (MSBuild on Windows was designed to be super chatty, not really following the UNIXy output-only-on-error philosophy), but it’s accomplishable:

$ dotnet build -nologo -consoleLoggerParameters:NoSummary -verbosity:quiet

$ echo $?
0

$ echo "syntax error">> Class1.cs

$ dotnet build -nologo -consoleLoggerParameters:NoSummary -verbosity:quiet
Class1.cs(9,13): error CS1002: ; expected [/Users/raines/src/quiet/quiet.csproj]

$ echo $?
1

You can use a Directory.Build.rsp to make that the default for your repo if you like.

Read more comments on GitHub >

github_iconTop Results From Across the Web

View LaTeX errors in quiet mode - TeX
In batch mode the console shows nothing, but the .log file contains: ! example error. l.3 \errmessage{example error} This error message was ...
Read more >
wget to print errors, but nothing otherwise
The --quiet option causes it to be totally quiet, even in the case of an error, it doesn't print anything.
Read more >
Better way to disable console inside unit tests
Using this method, only console.log is mocked and other console ... command npx jest --silent to get rid of all logs and errors...
Read more >
How to print only error message to the screen/output
am running a sed command, and it returns some information in the output on the screen, saying paring string....etc now, i don.
Read more >
Silent boot - ArchWiki
If you are still getting messages printed to the console, it may be dmesg sending you what it thinks are important messages. You...
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