> ## Documentation Index
> Fetch the complete documentation index at: https://docs.incredibuild.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Exporting the Build Monitor Log from the Command Line

> Produce the same log JSON as Build Monitor > File > Export log file from a CI pipeline, using BuildConsole /Mon and BuildMonitor.exe /exportlog.

Last updated on Aug 25, 2026

The Build Monitor's **File > Export log file** command has a command-line equivalent. `BuildMonitor.exe` accepts a saved `.ib_mon` monitor file together with the `/exportlog=` switch and runs the same export as the menu item, so a CI pipeline produces the same JSON a developer gets from the UI.

Exporting always takes two steps, because a monitor file is only complete once the build it describes has ended:

1. The build writes an `.ib_mon` file (`BuildConsole /Mon=`).

2. A separate post-build step converts that file to JSON (`BuildMonitor.exe <file> /exportlog=`).

If what you need is machine-readable build data for a dashboard rather than this specific file, see [Choosing between /exportlog and BuildDataExtractor](#choosing-between-exportlog-and-builddataextractor) below.

## Prerequisite: Basic logging or higher

The build must run with a logging level of **Basic** or higher. **Minimal** logging still produces a monitor file, but that file carries no log data to export, and the export fails with:

```
Build log is not available for this type of monitor file.
```

Set the level in one of these ways:

* On the Agent that initiates the build, go to **Agent Settings > Agent > General > Logging level** and select **Basic** or higher. See [Agent options](/windows/agent-options).

* Or override it for a single build with the [BuildConsole](/windows/build-console-cli) `/LogLevel` switch, for example `/LogLevel="Basic"`.

<Note>
  `/LimitBMData=1`, `2`, and `3` disable Build Monitor data writing. A build run with any of those values produces a monitor file with nothing useful to export, so leave `/LimitBMData` unset (or `0`) on builds whose log you intend to export.
</Note>

## Step 1: Save an .ib\_mon file during the build

Add `/Mon=` with a full path to your existing [BuildConsole](/windows/build-console-cli) (or `xgConsole`) command:

```
BuildConsole.exe MySolution.sln /build /cfg="Release|x64" /MON=C:\ci\artifacts\build.ib_mon
```

Keep these in mind when choosing the path:

* **Pass a full filename, not a folder.** If the value ends in a backslash, Incredibuild treats it as a folder and generates a GUID for the filename — the next step then has no predictable path to read.

* **The `.ib_mon` extension is added for you** if you leave it off.

* **`$(Title)` is expanded in the path**, so you can produce per-build filenames when the same command also passes `/Title=`.

## Step 2: Export the JSON after the build

Run the export as its own pipeline step, after the build step has finished:

```
start /wait "" "C:\Program Files (x86)\IncrediBuild\BuildMonitor.exe" "C:\ci\artifacts\build.ib_mon" /exportlog=C:\ci\artifacts\build_log.json
```

Four details decide whether this works:

* **Run it after the build, as a separate step.** The `.ib_mon` file is not finalized until the build ends, so the export cannot be folded into the build command.

* **Run it even when the build fails** — a failed build is usually the one whose log you want. Use `if: always()` in GitHub Actions, `condition: always()` in Azure DevOps, and wrap the build in `try`/`finally` in Jenkins.

* **`start /wait ""` is required.** `BuildMonitor.exe` is a GUI application, so invoking it directly returns immediately and the next pipeline step runs against a JSON file that has not been written yet. The empty `""` is the window title that `start` expects — without it, `start` treats the quoted path to the executable as the title and never launches it.

* **Put the `.ib_mon` path first, unprefixed, and use `=` for the switch.** Written with a space instead of an equals sign, `/exportlog C:\out.json` is silently ignored.

## Step 3: Publish the output files

The command writes two files:

| File             | Contents                                                                        |
| ---------------- | ------------------------------------------------------------------------------- |
| `build_log.json` | The log JSON — the same file the **File > Export log file** menu item produces. |
| `build_log.zip`  | The build's attachments, written alongside the JSON automatically.              |

Collect both if you want the full picture. The `.zip` is optional if you only need the log itself.

## Step 4: Verify that the export worked

`BuildMonitor.exe` does not return a meaningful exit code for this operation. Do not gate the pipeline on `%ERRORLEVEL%` here — it looks like success either way. Assert on the output file instead:

```
if not exist "C:\ci\artifacts\build_log.json" (
  echo Log export failed - check that the Agent logging level is Basic or higher
  exit /b 1
)
```

When the JSON is missing, the cause is almost always the prerequisite above: logging was below **Basic** during the build, and the console output says `Build log is not available for this type of monitor file.`

## Full example: GitHub Actions

This workflow builds, exports the log regardless of the build's outcome, and uploads both output files. For the rest of the GitHub Actions setup, see [Integrating with Github Actions](/windows/github).

```yaml theme={null}
- name: Build
  run: BuildConsole.exe MySolution.sln /build /cfg="Release|x64" /MON=${{ github.workspace }}\artifacts\build.ib_mon

- name: Export Build Monitor log JSON
  if: always()
  shell: cmd
  run: |
    start /wait "" "C:\Program Files (x86)\IncrediBuild\BuildMonitor.exe" "${{ github.workspace }}\artifacts\build.ib_mon" /exportlog=${{ github.workspace }}\artifacts\build_log.json
    if not exist "${{ github.workspace }}\artifacts\build_log.json" exit /b 1

- name: Upload
  if: always()
  uses: actions/upload-artifact@v4
  with:
    name: build-log
    path: artifacts/build_log.*
```

## Choosing between /exportlog and BuildDataExtractor

`BuildDataExtractor64.exe` also reads an `.ib_mon` file and also writes JSON, but it is a different tool that emits a different document. It is not a substitute when you need to match what the UI exports.

| Goal                                                                                               | Use                                                                          |
| -------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
| The same JSON as **File > Export log file**, including the Build Cache information shown in the UI | `BuildMonitor.exe <file>.ib_mon /exportlog=<out>.json`                       |
| Machine-readable build analytics — task timings, errors, graphs — for a dashboard                  | `BuildDataExtractor64.exe --source <file>.ib_mon --json --output <out>.json` |

`BuildDataExtractor64.exe` is a real console application with meaningful exit codes, which makes it the easier tool to script around. Choose it when you are building your own reporting on top of build data. Choose `/exportlog` when the requirement is specifically the log file the Build Monitor produces.

## Related

* [The Build Monitor Overview](/windows/build-monitor-what-to-know) — what the Build Monitor shows and how the log is used.

* [BuildConsole for Visual Studio](/windows/build-console-cli) — the full `/Mon`, `/LogLevel`, and `/LimitBMData` reference.

* [Exporting Logs to Support](/windows/exporting-logs) — a different workflow, for sending troubleshooting material to Incredibuild support.
