Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to lower docfx verbosity?

We use docfx, it is included as a nuget in one of our csproj files. I didn't personally setup the thing and I have no more information on how it works, but it looks like a simple nuget added to a C# project which then produces the documentation during the project compilation in Visual Studio.

Our problem is that the verbosity of build log is always set to verbose (or detailed or how they call it), i.e. I have like 20 c# projects in solution and since I have no warnings or errors, the build output in the Output window is very short for whole solution, just a few lines per project. But this one project with docfx always produce A LOT of output during compilation because it writes all verbose messages to Output window (and also to its log.txt file placed in the project's directory).

The question is how to get rid of this from the Output window. I tried to google it, I found that --logLevel warning parameter on command line can lower the verbosity. But we don't use any command line, we have the nuget in project. And I can see no place where this --logLevel warning can be specified.

(Using the latest nuget "docfx.console" version 2.40.4, the C# project is of type class library. I can see no special settings anywhere. Visual Studio setting for msbuild verbosity is set to minimal both for Output window and log file.)

like image 406
Al Kepp Avatar asked Dec 04 '18 12:12

Al Kepp


1 Answers

EDIT: Since my first response, I have discovered a better way to do it at the project level.

If you edit the .csproj file for the DocFx project to include the following property group, you can set the log level on the project.

<PropertyGroup>
  <LogLevel>Warning</LogLevel>
</PropertyGroup>

I got the idea from this comment on this git issue: https://github.com/dotnet/docfx/issues/2595#issuecomment-379947069


ORIGINAL RESPONSE:

I have only found one way to do it, but it will be at the global level, and you may have to set it again if you upgrade to a new version.

You can modify the docfx.console.targets file to change the log level. On my computer it is found at

C:\Users\<username>\.nuget\packages\docfx.console\<version number>\build\docfx.console.targets

This is an XML file with a place you can set the log level to be used.

<Project ...>
  <PropertyGroup>
    ...
    <LogLevel Condition=" '$(LogLevel)' == '' ">Verbose</LogLevel>
    ...
  </PropertyGroup>

I changed "Verbose" to "Warning" and it significantly reduced the log messages that were generated.

Hopefully this can help you too!

like image 155
Brad Lawrence Avatar answered Oct 16 '22 06:10

Brad Lawrence