Create the OTEL_DIAGNOSTICS.json
file to enable the internal logs generated by all OpenTelemetry components.
[String]
LogDirectory The directory where the output log file will be stored. It can be an absolute path or a relative path to the current directory. Default is current directory.[Int32]
FileSize Specifies the log file size in KiB. The log file will never exceed this configured size, and will be overwritten in a circular way. Default is32768
.[Diagnostics.Tracing.EventLevel]
LogLevel The lowest level of the events to be captured. Default isWarning
.
Write an Otel Diagnostic log to C:\logs.
Enable-OtelDiagnosticLog -LogDirectory C:\logs
Includes the Error and Critical levels.
Enable-OtelDiagnosticLog -LogLevel Warning
- Disable-OtelDiagnosticLog
- https://github.com/open-telemetry/opentelemetry-dotnet/tree/main/src/OpenTelemetry#self-diagnostics
The self-diagnostics feature can be enabled/changed/disabled while the process is running (without restarting the process). The SDK will attempt to read the configuration file every 10 seconds in non-exclusive read-only mode. The SDK will create or overwrite a file with new logs according to the configuration. This file will not exceed the configured max size and will be overwritten in a circular way.
A log file named as ExecutableName.ProcessId.log
(e.g. pwsh.exe.12345.log) will be generated at the specified directory LogDirectory, into which logs are written to.