diff --git a/platform-includes/logs/options/dotnet.mdx b/platform-includes/logs/options/dotnet.mdx index 109b4499fbb3b..ed7e850819e0d 100644 --- a/platform-includes/logs/options/dotnet.mdx +++ b/platform-includes/logs/options/dotnet.mdx @@ -1,7 +1,9 @@ #### EnableLogs -Set to `true` in order to enable the `SentrySdk.Logger` APIs. +Set to `true` to send logs captured by logging integrations, such as `Microsoft.Extensions.Logging`, Serilog, NLog, and log4net. Defaults to `false`. + +Since version 6.10.0, this option doesn't apply to logs sent through the `SentrySdk.Logger` APIs. Those logs are always sent. @@ -47,7 +49,7 @@ Use standard `Microsoft.Extensions.Logging` filtering to reduce noisy categories } ``` -Setting `Logging:Sentry:LogLevel:Default` to `None` disables logs sent through the `Microsoft.Extensions.Logging` provider for all categories, while `EnableLogs = true` keeps the `SentrySdk.Logger` APIs available. +Setting `Logging:Sentry:LogLevel:Default` to `None` disables logs sent through the `Microsoft.Extensions.Logging` provider for all categories. Logs sent through the `SentrySdk.Logger` APIs aren't affected by these filters and are still sent. Example with `EnableLogs = true` and `Logging:Sentry:LogLevel:Default = None`: diff --git a/platform-includes/logs/setup/dotnet.mdx b/platform-includes/logs/setup/dotnet.mdx index 4757af348c62e..8cbc3217063c1 100644 --- a/platform-includes/logs/setup/dotnet.mdx +++ b/platform-includes/logs/setup/dotnet.mdx @@ -1,4 +1,4 @@ -To enable logging, you need to initialize the SDK with the `EnableLogs` option set to `true`. +Logs sent through the `SentrySdk.Logger` APIs are always sent, so they don't need any extra configuration. To send logs captured by logging integrations, initialize the SDK with the `EnableLogs` option set to `true`. @@ -6,13 +6,10 @@ To enable logging, you need to initialize the SDK with the `EnableLogs` option s SentrySdk.Init(options => { options.Dsn = "___PUBLIC_DSN___"; - // Enable logs to be sent to Sentry - options.EnableLogs = true; }); ``` - -This enables the `SentrySdk.Logger` APIs. +You don't need a logs-specific option to use the `SentrySdk.Logger` APIs. Set `EnableLogs = true` only if you also send logs through a logging integration. @@ -28,7 +25,7 @@ This enables the `SentrySdk.Logger` APIs. ``` -This enables the `SentrySdk.Logger` APIs, as well as the `Microsoft.Extensions.Logging` integration. +This enables the `Microsoft.Extensions.Logging` integration. The `SentrySdk.Logger` APIs don't depend on `EnableLogs`. diff --git a/platform-includes/logs/usage/dotnet.mdx b/platform-includes/logs/usage/dotnet.mdx index 9136ca9004002..794c46b4a8ee3 100644 --- a/platform-includes/logs/usage/dotnet.mdx +++ b/platform-includes/logs/usage/dotnet.mdx @@ -1,6 +1,6 @@ -Once the feature is enabled on the SDK and the SDK is initialized, you can send logs using the `SentrySdk.Logger` APIs. +Once the SDK is initialized, you can send logs using the `SentrySdk.Logger` APIs. The `SentryStructuredLogger` type exposes six method groups that you can use to log messages at different log levels: `Trace`, `Debug`, `Info`, `Warning`, `Error`, and `Fatal`.