Skip to content

Repo sync for protected branch #5395

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Jun 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 25 additions & 11 deletions docs/build/reference/experimental-log.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
---
title: "/experimental:log (Structured SARIF diagnostics)"
description: "Use the /experimental:log compiler option to output experimental structured SARIF output for diagnostics."
ms.date: 10/26/2023
description: "The /experimental:log compiler option outputs experimental structured SARIF output for diagnostics."
ms.date: 06/05/2025
f1_keywords: ["/experimental:log"]
helpviewer_keywords: ["/experimental:log", "SARIF", "structured diagnostics"]
---
# `/experimental:log` (Structured SARIF diagnostics)

Output [SARIF](https://sarifweb.azurewebsites.net/) diagnostics to the specified file. For more information, see [Structured SARIF Diagnostics](sarif-output.md).
Output [SARIF](https://sarifweb.azurewebsites.net/) diagnostics to the specified file or directory. For more information, see [Structured SARIF Diagnostics](sarif-output.md).

## Syntax

> **`/experimental:log`** *filename*
> **`/experimental:log`** *filename*\
> **`/experimental:log`** *directoryname\\*

## Arguments

*filename*

Where to output SARIF diagnostics. The `.sarif` suffix is added to *filename* to produce the final filename at which to store the resulting SARIF diagnostics. The space between `/experimental:log` and *filename* is optional. Paths that include spaces must be enclosed in double quotes. *filename* may name a relative or absolute path.
The output file for SARIF diagnostics. The compiler automatically adds the `.sarif` extension to *filename*. The space between `/experimental:log` and *filename* is optional. Use double quotes around paths containing spaces. Both relative and absolute paths are supported.

*directoryname\\*

The output directory for SARIF diagnostics (for example, `/experimental:log sarif_output\`). Remember to add the trailing backslash (`\`) to indicate it's a directory. Each source file name forms the base name for each SARIF file saved in the directory. The compiler automatically adds the `.sarif` extension to each file name. The space between `/experimental:log` and *directoryname\\* is optional. Use double quotes around paths containing spaces. Both relative and absolute paths are supported.

## Remarks

Expand All @@ -28,19 +33,28 @@ Diagnostics are also output as text to the console as usual.
### To set this compiler option in the Visual Studio development environment

1. Open the project's **Property Pages** dialog box. For details, see [Set C++ compiler and build properties in Visual Studio](../working-with-project-properties.md).

1. Select the specific project **Configuration** and **Platform** for which you want to change the property. You can also choose **"All Configurations"** and **"All Platforms"**.

1. Select the **Configuration Properties** > **C/C++** > **Command Line** property page.

1. Modify the **Additional Options** property, and then choose **OK**.

## Example
## Examples

The following command produces SARIF information for the compilation of `main.cpp` and saves it in the file `main.sarif`:

```cmd
cl /experimental:log main.cpp
```

The following command produces SARIF information for the compilation of `main.cpp` and saves it in the file `mySarifInfo.sarif`:

```cmd
cl /experimental:log mySarifInfo main.cpp
```

The following command produces SARIF information for the entire compilation in the `diags.sarif` file in the current directory:
The following command produces SARIF information for the entire compilation and saves it in the `sarif_output` directory in the files `main.sarif` and `other.sarif`:

```cmd
CL /experimental:logdiags main.cpp other.cpp
cl /experimental:log sarif_output\ main.cpp other.cpp
```

## See also
Expand Down
1 change: 1 addition & 0 deletions docs/docfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@
"cross-platform/**.md": "tools",
"data/**.md": "data-access",
"dotnet/**.md": "cli-lang",
"embedded/**.md": "tools",
"error-messages/**.md": "errors-warnings",
"extensions/**.md": "cli-lang",
"get-started/**.md": "cpp-lang",
Expand Down