View, save, and configure build log files
After you build a project in the Visual Studio Interactive Development Environment (IDE), you can view logged information about the build in the Visual Studio Output window. The output data can be saved to log files that you can view in Visual Studio and other editors.
The logs can help you troubleshoot issues in the build. You can locate the exact command lines used for all build tools, and get full diagnostic data about the entire build process. Visual Studio provides options to specify the kinds of information you want to see in the build output and build log files.
This article describes how to generate, configure, and view build log files in Visual Studio.
Generate and view build log files
Use the following procedures to generate and view build log files for your scenario.
C++ project:
Visual Studio saves the log files for you when you build your project. Common locations for the log files include Release\<ProjectName>.log, Debug\<ProjectName>.log, and <ProjectName>.txt. All file locations are relative to your project root folder and based on your specific configuration.
Use Windows Explorer or File Explorer to browse to the log file.
Open the log file in your preferred editor.
.NET project:
For .NET projects, you instruct Visual Studio to save the log files:
In Visual Studio, select Build > Build Solution.
In the Output window, select in the text and use the Ctrl+S keyboard shortcut.
Visual Studio prompts you for a location to save the build output. You can then open the log files from that location in Visual Studio or another editor.
MSBuild:
You can generate build logs by running MSBuild directly from the command line by using the
-fileLogger
(-fl
) command-line option. For more information, see Obtain build logs with MSBuild.
Specify data verbosity for build logs
You can specify how much information to include in the build log files. The amount of data in the log file columns is measured as logger verbosity. The number of log file rows represent messages collected. The log verbosity (column values) affects the types of logged messages (row values). Quiet verbosity produces minimal logging in the build output. Diagnostic is the most verbose setting and generates log files with all possible data.
The following table shows what types of messages are collected based on the logger verbosity:
Message type / Verbosity | Quiet | Minimal | Normal | Detailed | Diagnostic |
---|---|---|---|---|---|
Errors | ✅ | ✅ | ✅ | ✅ | ✅ |
Warnings | ✅ | ✅ | ✅ | ✅ | ✅ |
High-importance messages | ✅ | ✅ | ✅ | ✅ | |
Normal-importance messages | ✅ | ✅ | ✅ | ||
Low-importance messages | ✅ | ✅ | |||
Other MSBuild-engine information | ✅ |
You can configure the logger verbosity with the following steps:
In Visual Studio, select Tools > Options to open the Options dialog.
On the dialog, expand the Projects and Solutions section and select the Build and Run tab.
Use the MSBuild project build output verbosity dropdown list and select your build output preference.
Use the MSBuild project build log file verbosity dropdown list and select your logger verbosity preference.
Tip
If you want to see the command lines used for the compiler and other tools, choose at least the Detailed verbosity level.
To apply your changes, select OK.
Important
You must rebuild the project for your changes to take effect in the Output window. For C++ projects, the project rebuild also ensures the changes are reflected in the <ProjectName>.txt file.
For more information, see Options dialog box, Projects and Solutions, Build and Run and LoggerVerbosity.
Use binary logs for large log files
Binary logs are an optional feature for .NET projects that lets you have a richer log browsing experience that might make it easier to find information in large logs. To use binary logs, install the Project System Tools. For more information, see https://msbuildlog.com
and Binary Log.
Binary logs are an optional feature for .NET projects that lets you have a richer log browsing experience that might make it easier to find information in large logs. To use binary logs, install the Project System Tools 2022. For more information, see https://msbuildlog.com
and Binary Log.