diff --git a/docs/platforms/java/guides/jul/usage/advanced-usage.mdx b/docs/platforms/java/guides/jul/usage/advanced-usage.mdx index 51c129b1ef24a..59265c46e9936 100644 --- a/docs/platforms/java/guides/jul/usage/advanced-usage.mdx +++ b/docs/platforms/java/guides/jul/usage/advanced-usage.mdx @@ -158,8 +158,11 @@ class MyClass { ## Context Tags -Starting with Sentry version 6.0.0 and up, you can define a list of `MDC tags` that will be viewable as `Tags` in the Sentry UI. `MDC Tags` not in this list will be viewable as `Context Data`. To define tags, add a `context-tags` entry with the tags as comma-separated items to the `sentry.properties` file. +Starting with Sentry version 6.0.0 and up, you can define a list of `MDC tags` that will be viewable as `Tags` in the Sentry UI. `MDC Tags` not in this list will be viewable as `Context Data`. +As of Sentry Java SDK version 8.24.0, `contextTags` also applies to [structured logs](https://docs.sentry.io/product/explore/logs/). MDC properties matching the configured `contextTags` will be attached to log entries as attributes, prefixed with "mdc.". + +To define a tag that shall be sent with events and logs, add a `context-tags` entry with the tags as comma-separated items to the `sentry.properties` file. ```properties {tabTitle:Properties} dsn=___PUBLIC_DSN___ diff --git a/docs/platforms/java/guides/log4j2/advanced_usage.mdx b/docs/platforms/java/guides/log4j2/advanced_usage.mdx index 4a642de1bf5e7..f250d2e74aa33 100644 --- a/docs/platforms/java/guides/log4j2/advanced_usage.mdx +++ b/docs/platforms/java/guides/log4j2/advanced_usage.mdx @@ -141,8 +141,11 @@ class MyClass { ## Context Tags -Starting with Sentry version 6.0.0 and up, you can define a list of `MDC tags` that will be viewable as `Tags` in the Sentry UI. `MDC Tags` not in this list will be viewable as `Context Data`. To define tags, add a `contextTags` attribute to the `` tag in your `log4j2.xml` with the tags as comma-separated items. +Starting with Sentry version 6.0.0 and up, you can define a list of `MDC tags` that will be viewable as `Tags` in the Sentry UI. `MDC Tags` not in this list will be viewable as `Context Data`. +As of Sentry Java SDK version 8.24.0, `contextTags` also applies to [structured logs](https://docs.sentry.io/product/explore/logs/). MDC properties matching the configured `contextTags` will be attached to log entries as attributes, prefixed with "mdc.". + +To define a tag that shall be sent with events and logs, add a `contextTags` attribute to the `` tag in your `log4j2.xml` with the tags as comma-separated items. ```xml {tabTitle:XML} ` entry inside the `` of the Sentry appender configuration in `logback.xml` +Starting with Sentry version 6.0.0 and up, you can define a list of `MDC tags` that will be viewable as `Tags` in the Sentry UI. `MDC Tags` not in this list will be viewable as `Context Data`. +As of Sentry Java SDK version 8.24.0, `contextTags` also applies to [structured logs](https://docs.sentry.io/product/explore/logs/). MDC properties matching the configured `contextTags` will be attached to log entries as attributes, prefixed with "mdc.". + +To define a tag that shall be sent with events and logs, add a `` entry inside the `` of the Sentry appender configuration in `logback.xml`. ```xml {tabTitle:XML} diff --git a/docs/platforms/java/guides/spring-boot/logging-frameworks.mdx b/docs/platforms/java/guides/spring-boot/logging-frameworks.mdx index d4128fe3ada9b..5fc7aaee7f499 100644 --- a/docs/platforms/java/guides/spring-boot/logging-frameworks.mdx +++ b/docs/platforms/java/guides/spring-boot/logging-frameworks.mdx @@ -73,6 +73,10 @@ However, if errors that may appear during startup should to be sent to Sentry, t +#### Mapped Diagnostic Context (MDC) + +Starting with Sentry Java SDK version 8.24.0, you can use the `contextTags` option to include specific properties from the Mapped Diagnostic Context (MDC) as attributes on log entries sent to Sentry. + ### Log4j 2 To use Sentry's Log4j 2 integration in Spring Boot application, you must include a dependency to the `sentry-log4j2` module: @@ -125,3 +129,7 @@ You do not need to configure your DSN in the Log4j 2 configuration file since Se However, if errors that may appear during startup should to be sent to Sentry, the DSN must be provided to both the Log4j 2 and Spring Boot configurations. + +#### Mapped Diagnostic Context (MDC) + +Starting with Sentry Java SDK version 8.24.0, you can use the `contextTags` option to include specific properties from the Mapped Diagnostic Context (MDC) as attributes on log entries sent to Sentry. diff --git a/platform-includes/logs/options/java.mdx b/platform-includes/logs/options/java.mdx index 7c6a6d8c1b916..3809d877f6568 100644 --- a/platform-includes/logs/options/java.mdx +++ b/platform-includes/logs/options/java.mdx @@ -31,3 +31,9 @@ Sentry.init { options -> The `beforeSend` function receives a log object, and should return the log object if you want it to be sent to Sentry, or `null` if you want to discard it. + +#### contextTags + +You can use the `contextTags` option to include specific properties from the Mapped Diagnostic Context (MDC) as attributes on log entries sent to Sentry. + +For detailed configuration examples, see the Advanced Usage documentation for your logging framework.