Skip to content

Commit 3395cd9

Browse files
Merge pull request #5395 from MicrosoftDocs/main638848278079453454sync_temp
For protected branch, push strategy should use PR and merge to target branch method to work around git push error
2 parents 5d9aa8a + 5960685 commit 3395cd9

File tree

2 files changed

+26
-11
lines changed

2 files changed

+26
-11
lines changed

docs/build/reference/experimental-log.md

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,28 @@
11
---
22
title: "/experimental:log (Structured SARIF diagnostics)"
3-
description: "Use the /experimental:log compiler option to output experimental structured SARIF output for diagnostics."
4-
ms.date: 10/26/2023
3+
description: "The /experimental:log compiler option outputs experimental structured SARIF output for diagnostics."
4+
ms.date: 06/05/2025
55
f1_keywords: ["/experimental:log"]
66
helpviewer_keywords: ["/experimental:log", "SARIF", "structured diagnostics"]
77
---
88
# `/experimental:log` (Structured SARIF diagnostics)
99

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

1212
## Syntax
1313

14-
> **`/experimental:log`** *filename*
14+
> **`/experimental:log`** *filename*\
15+
> **`/experimental:log`** *directoryname\\*
1516
1617
## Arguments
1718

1819
*filename*
1920

20-
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.
21+
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.
22+
23+
*directoryname\\*
24+
25+
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.
2126

2227
## Remarks
2328

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

3035
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).
31-
3236
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"**.
33-
3437
1. Select the **Configuration Properties** > **C/C++** > **Command Line** property page.
35-
3638
1. Modify the **Additional Options** property, and then choose **OK**.
3739

38-
## Example
40+
## Examples
41+
42+
The following command produces SARIF information for the compilation of `main.cpp` and saves it in the file `main.sarif`:
43+
44+
```cmd
45+
cl /experimental:log main.cpp
46+
```
47+
48+
The following command produces SARIF information for the compilation of `main.cpp` and saves it in the file `mySarifInfo.sarif`:
49+
50+
```cmd
51+
cl /experimental:log mySarifInfo main.cpp
52+
```
3953

40-
The following command produces SARIF information for the entire compilation in the `diags.sarif` file in the current directory:
54+
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`:
4155

4256
```cmd
43-
CL /experimental:logdiags main.cpp other.cpp
57+
cl /experimental:log sarif_output\ main.cpp other.cpp
4458
```
4559

4660
## See also

docs/docfx.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@
139139
"cross-platform/**.md": "tools",
140140
"data/**.md": "data-access",
141141
"dotnet/**.md": "cli-lang",
142+
"embedded/**.md": "tools",
142143
"error-messages/**.md": "errors-warnings",
143144
"extensions/**.md": "cli-lang",
144145
"get-started/**.md": "cpp-lang",

0 commit comments

Comments
 (0)