# Startup diagnostics > [!NOTE] > This document does not apply to Azure Function hosts. For Azure Function hosts, see [Azure Function Isolated Worker diagnostics](/nservicebus/hosting/azure-functions-service-bus/index.md#configuration-startup-diagnostics). To make troubleshooting easier, diagnostic information is collected during endpoint startup and written to a `.diagnostics` sub-folder in the host output directory. > [!NOTE] > By default, the output directory is called `AppDomain.CurrentDomain.BaseDirectory`, except for web applications where `App_Data` is used instead. To change the output path: ```cs endpointConfiguration.SetDiagnosticsPath("myCustomPath"); ``` At every endpoint startup the current diagnostics will be written to `{endpointName}-configuration.txt`. If possible, attach this file to support requests. > [!WARNING] > The structure and format of the data produced should not be considered stable or parsable. Nodes may be added, removed, or moved in minor and patch versions. ### Sample content Sample partial content of the startup diagnostics (formatted for readability): ```txt { "Container": { "Type": "external" }, "Endpoint": { "Name": "StartUpDiagnosticsWriter", "SendOnly": false, "NServiceBusVersion": "10.2.0" }, "Features": [ { "Name": "NServiceBus.ReceiveStatisticsFeature", "Enabled": false, "Active": true, "PrerequisiteStatus": { "IsSatisfied": true, "Reasons": [] }, "Dependencies": [], "Version": "10.2.0", ... ``` ## Writing diagnostics to the log Starting in version 10.2, diagnostics can also be written to the application log. This is useful in environments where writing to the file system is unavailable or impractical, such as containerized or serverless deployments. ```cs endpointConfiguration.WriteDiagnosticsToLog(); ``` When `WriteDiagnosticsToLog` is enabled, diagnostics are written to the log **in addition to** the default file-based output or any custom diagnostics writer. The `AssemblyScanning` section is automatically compacted to prevent exceeding log size limits, such as the [Application Insights 64 KB telemetry limit](https://learn.microsoft.com/en-us/azure/azure-monitor/fundamentals/service-limits#application-insights). If the compacted diagnostics still exceed a safe threshold, the output is truncated and a warning is logged. ## Writing to other targets To take full control of how diagnostics are written: ```cs endpointConfiguration.CustomDiagnosticsWriter( (diagnostics, ct) => { //custom logic to write data return Task.CompletedTask; }); ``` ## Adding startup diagnostics sections To extend the startup diagnostics with custom sections: ```cs settings.AddStartupDiagnosticsSection( sectionName: "MySection", section: new { SomeSetting = "some data", SomeOtherSetting = 10 }); ``` Settings can be accessed from a [feature](/nservicebus/pipeline/features.md#feature-setup) or via the [endpoint configuration](/nservicebus/pipeline/features.md#feature-settings-endpointconfiguration).