Skip to content

Commit ca517b7

Browse files
authored
Merge pull request #3548 from Mikejo5000/mikejo-br14
MSBuild log verbosity table
2 parents d8c0037 + 26b5131 commit ca517b7

File tree

1 file changed

+33
-15
lines changed

1 file changed

+33
-15
lines changed

docs/msbuild/obtaining-build-logs-with-msbuild.md

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,53 +15,69 @@ ms.workload:
1515
- "multiple"
1616
---
1717
# Obtain build logs with MSBuild
18+
1819
By using switches with MSBuild, you can specify how much build data you want to review and whether you want to save build data to one or more files. You can also specify a custom logger to collect build data. For information about MSBuild command-line switches that this topic doesn't cover, see [Command-line reference](../msbuild/msbuild-command-line-reference.md).
1920

2021
> [!NOTE]
21-
> If you build projects by using the Visual Studio IDE, you can troubleshoot those builds by reviewing build logs. For more information, see [How to: View, save, and configure build log files](../ide/how-to-view-save-and-configure-build-log-files.md).
22+
> If you build projects by using the Visual Studio IDE, you can troubleshoot those builds by reviewing build logs. For more information, see [How to: View, save, and configure build log files](../ide/how-to-view-save-and-configure-build-log-files.md).
2223
2324
## Set the level of detail
25+
2426
When you build a project by using MSBuild without specifying a level of detail, the following information appears in the output log:
2527

26-
- Errors, warnings, and messages that are categorized as highly important.
28+
- Errors, warnings, and messages that are categorized as highly important.
2729

28-
- Some status events.
30+
- Some status events.
2931

30-
- A summary of the build.
32+
- A summary of the build.
3133

3234
By using the **-verbosity** (**-v**) switch, you can control how much data appears in the output log. For troubleshooting, use a verbosity level of either `detailed` (`d`) or `diagnostic` (`diag`), which provides the most information.
3335

3436
The build process may be slower when you set the **-verbosity** to `detailed` and even slower when you set the **-verbosity** to `diagnostic`.
35-
36-
```cmd
37+
38+
```cmd
3739
msbuild MyProject.proj -t:go -v:diag
3840
```
3941

42+
### Verbosity settings
43+
44+
The following table shows how the log verbosity (column values) affects which types of message (row values) are logged.
45+
46+
| | Quiet | Minimal | Normal | Detailed | Diagnostic |
47+
|---------------------------------------|:-----:|:-------:|:------:|:--------:|:----------:|
48+
| Errors ||||||
49+
| Warnings ||||||
50+
| High-importance Messages | |||||
51+
| Normal-importance Messages | | ||||
52+
| Low-importance Messages | | | |||
53+
| Additional MSBuild-engine information | | | | ||
54+
4055
## Save the build log to a file
41-
You can use the **-fileLogger** (**fl**) switch to save build data to a file. The following example saves build data to a file that's named *msbuild.log*.
42-
56+
57+
You can use the **-fileLogger** (**fl**) switch to save build data to a file. The following example saves build data to a file that's named *msbuild.log*.
58+
4359
```cmd
4460
msbuild MyProject.proj -t:go -fileLogger
4561
```
46-
62+
4763
In the following example, the log file is named *MyProjectOutput.log*, and the verbosity of the log output is set to `diagnostic`. You specify those two settings by using the **-filelogparameters** (`flp`) switch.
48-
64+
4965
```cmd
5066
msbuild MyProject.proj -t:go -fl -flp:logfile=MyProjectOutput.log;verbosity=diagnostic
5167
```
52-
68+
5369
For more information, see [Command-line reference](../msbuild/msbuild-command-line-reference.md).
5470

5571
## Save the log output to multiple files
72+
5673
The following example saves the entire log to *msbuild1.log*, just the errors to *JustErrors.log*, and just the warnings to *JustWarnings.log*. The example uses file numbers for each of the three files. The file numbers are specified just after the **-fl** and **-flp** switches (for example, `-fl1` and `-flp1`).
5774

5875
The **-filelogparameters** (`flp`) switches for files 2 and 3 specify what to name each file and what to include in each file. No name is specified for file 1, so the default name of *msbuild1.log* is used.
59-
76+
6077
```cmd
6178
msbuild MyProject.proj -t:go -fl1 -fl2 -fl3 -flp2:logfile=JustErrors.log;errorsonly -flp3:logfile=JustWarnings.log;warningsonly
62-
6379
```
64-
80+
6581
For more information, see [Command-line reference](../msbuild/msbuild-command-line-reference.md).
6682

6783
## Save a binary log
@@ -73,15 +89,17 @@ In the following example, a binary log file is created with the name *binarylogf
7389
```cmd
7490
/bl:binarylogfilename.binlog
7591
```
76-
92+
7793
For more information, see [Command-line reference](../msbuild/msbuild-command-line-reference.md).
7894

7995
## Use a custom logger
96+
8097
You can write your own logger by authoring a managed type that implements the <xref:Microsoft.Build.Framework.ILogger> interface. You might use a custom logger, for instance, to send build errors in email, log them to a database, or log them to an XML file. For more information, see [Build loggers](../msbuild/build-loggers.md).
8198

8299
In the MSBuild command line, you specify the custom logger by using the **-logger** switch. You can also use the **-noconsolelogger** switch to disable the default console logger.
83100

84101
## See also
102+
85103
<xref:Microsoft.Build.Framework.LoggerVerbosity>
86104
[Build loggers](../msbuild/build-loggers.md)
87105
[Logging in a multi-processor environment](../msbuild/logging-in-a-multi-processor-environment.md)

0 commit comments

Comments
 (0)