Skip to content

Commit 8a46fac

Browse files
authored
Add documentation for DOTNET_HOST_TRACE environment variables (.NET 10+) (#47603)
1 parent b884778 commit 8a46fac

File tree

2 files changed

+25
-10
lines changed

2 files changed

+25
-10
lines changed

docs/core/dependency-loading/default-probing.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,13 @@ Each property is available by calling the <xref:System.AppContext.GetData(System
4444

4545
The .NET Core runtime host will output useful trace messages when certain environment variables are enabled:
4646

47-
|Environment Variable |Description |
48-
|----------------------------|---------|
49-
|`COREHOST_TRACE=1` |Enables tracing.|
50-
|`COREHOST_TRACEFILE=<path>` |Traces to a file path instead of the default `stderr`.|
51-
|`COREHOST_TRACE_VERBOSITY` |Sets the verbosity from 1 (lowest) to 4 (highest).|
47+
|Environment Variable |Description |
48+
|-------------------------------|---------|
49+
|`DOTNET_HOST_TRACE=1` |Enables tracing.|
50+
|`DOTNET_HOST_TRACEFILE=<path>` |Traces to a file path instead of the default `stderr`.|
51+
|`DOTNET_HOST_TRACE_VERBOSITY` |Sets the verbosity from 1 (lowest) to 4 (highest).|
52+
53+
For more information, see [DOTNET_HOST_TRACE environment variables](../tools/dotnet-environment-variables.md#dotnet_host_trace).
5254

5355
## Managed assembly default probing
5456

docs/core/tools/dotnet-environment-variables.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -395,20 +395,33 @@ Specifies the minimum number of hours between background downloads of advertisin
395395

396396
Specifies whether .NET SDK local tools search for tool manifest files in the root folder on Windows. The default is `false`.
397397

398-
### `COREHOST_TRACE`
398+
### `DOTNET_HOST_TRACE`
399+
400+
**This variable applies to .NET 10 and later versions.** For older versions, replace the `DOTNET_HOST_` prefix with [`COREHOST_`](#corehost_trace).
399401

400402
Controls diagnostics tracing from the hosting components, such as `dotnet.exe`, `hostfxr`, and `hostpolicy`.
401403

402-
- `COREHOST_TRACE=[0/1]` - default is `0` - tracing disabled. If set to `1`, diagnostics tracing is enabled.
403-
- `COREHOST_TRACEFILE=<file path>` - has an effect only if tracing is enabled by setting `COREHOST_TRACE=1`. When set, the tracing information is written to the specified file; otherwise, the trace information is written to `stderr`.
404-
- `COREHOST_TRACE_VERBOSITY=[1/2/3/4]` - default is `4`. The setting is used only when tracing is enabled via `COREHOST_TRACE=1`.
404+
- `DOTNET_HOST_TRACE=[0/1]` - default is `0` - tracing disabled. If set to `1`, diagnostics tracing is enabled.
405+
- `DOTNET_HOST_TRACEFILE=<file path>` - has an effect only if tracing is enabled by setting `DOTNET_HOST_TRACE=1`. When set, the tracing information is written to the specified file; otherwise, the trace information is written to `stderr`.
406+
- `DOTNET_HOST_TRACE_VERBOSITY=[1/2/3/4]` - default is `4`. The setting is used only when tracing is enabled via `DOTNET_HOST_TRACE=1`.
405407

406408
- `4` - all tracing information is written
407409
- `3` - only informational, warning, and error messages are written
408410
- `2` - only warning and error messages are written
409411
- `1` - only error messages are written
410412

411-
The typical way to get detailed trace information about application startup is to set `COREHOST_TRACE=1` and`COREHOST_TRACEFILE=host_trace.txt` and then run the application. A new file `host_trace.txt` will be created in the current directory with the detailed information.
413+
The typical way to get detailed trace information about application startup is to set `DOTNET_HOST_TRACE=1` and `DOTNET_HOST_TRACEFILE=host_trace.txt` and then run the application. A new file `host_trace.txt` will be created in the current directory with the detailed information.
414+
415+
### `COREHOST_TRACE`
416+
417+
Controls diagnostics tracing from the hosting components, such as `dotnet.exe`, `hostfxr`, and `hostpolicy`.
418+
419+
> [!NOTE]
420+
> Starting with .NET 10, use the [`DOTNET_HOST_TRACE`](#dotnet_host_trace) environment variables instead. The `COREHOST_TRACE` variables work the same as `DOTNET_HOST_TRACE` variables.
421+
422+
- `COREHOST_TRACE` - see [`DOTNET_HOST_TRACE`](#dotnet_host_trace).
423+
- `COREHOST_TRACEFILE` - see [`DOTNET_HOST_TRACEFILE`](#dotnet_host_trace).
424+
- `COREHOST_TRACE_VERBOSITY` - see [`DOTNET_HOST_TRACE_VERBOSITY`](#dotnet_host_trace).
412425

413426
### `SuppressNETCoreSdkPreviewMessage`
414427

0 commit comments

Comments
 (0)