Promote MDC Logging Feature to Supported State

Closes #41205

Signed-off-by: Ruchika Jha <ruchika@li-0551ffcc-341d-11b2-a85c-a28deda416be.ibm.com>
Signed-off-by: Alexander Schwartz <alexander.schwartz@ibm.com>
Co-authored-by: Ruchika Jha <ruchika@li-0551ffcc-341d-11b2-a85c-a28deda416be.ibm.com>
Co-authored-by: Alexander Schwartz <alexander.schwartz@ibm.com>
This commit is contained in:
ruchikajha95 2025-11-25 18:53:34 +00:00 committed by GitHub
parent 8a9e585899
commit 570ac40025
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 78 additions and 7 deletions

View File

@ -149,7 +149,7 @@ public class Profile {
WORKFLOWS("Workflows", Type.EXPERIMENTAL),
LOG_MDC("Mapped Diagnostic Context (MDC) information in logs", Type.PREVIEW),
LOG_MDC("Mapped Diagnostic Context (MDC) information in logs", Type.DEFAULT),
DB_TIDB("TiDB database type", Type.EXPERIMENTAL),
@ -260,11 +260,36 @@ public class Profile {
public enum Type {
// in priority order
/**
* Fully supported and enabled by default.
*/
DEFAULT("Default"),
/**
* Fully supported and disabled by default.
*/
DISABLED_BY_DEFAULT("Disabled by default"),
/**
* Fully supported and will be removed in a future major release.
*/
DEPRECATED("Deprecated"),
/**
* Not supported for production yet and not enabled by default.
* Usually with documentation and feature complete. Soon to be graduated to supported.
*/
PREVIEW("Preview"),
PREVIEW_DISABLED_BY_DEFAULT("Preview disabled by default"), // Preview features, which are not automatically enabled even with enabled preview profile (Needs to be enabled explicitly)
/**
* Preview features, which are not automatically enabled even with enabled preview profile (Needs to be enabled explicitly).
* This is no longer used and not explained in the current docs.
*
* @deprecated forRemoval, since 26.5
*/
PREVIEW_DISABLED_BY_DEFAULT("Preview disabled by default"),
EXPERIMENTAL("Experimental");
private final String label;

View File

@ -38,4 +38,13 @@ This provides a more fine-grained way to manage features and eliminates the need
The `feature-<name>` option takes precedence over both `features` and `features-disabled`.
For more details, see the https://www.keycloak.org/server/features[Enabling and disabling features] guide.
For more details, see the https://www.keycloak.org/server/features[Enabling and disabling features] guide.
== MDC Logging feature (supported)
The `log-mdc:v1` feature has been promoted from a preview feature to a supported feature.
MDC enables Keycloak to enrich log entries with contextual information such as realm, client, user ID and IP address, significantly improving debugging and observability.
For more details, see the https://www.keycloak.org/server/logging#_adding_context_for_log_messages[Adding context for log messages] guide.

View File

@ -158,14 +158,12 @@ In order to see the `org.keycloak.events:trace`, the `trace` level must be set f
[[mdc]]
== Adding context for log messages
<@features.techpreview feature="log-mdc"/>
You can enable additional context information for each log line like the current realm and client that is executing the request.
Use the option `log-mdc-enabled` to enable it.
.Example configuration
<@kc.start parameters="--features=log-mdc --log-mdc-enabled=true"/>
<@kc.start parameters="--log-mdc-enabled=true"/>
.Example output
----

View File

@ -267,7 +267,7 @@ public class LoggingDistTest {
}
@Test
@Launch({ "start-dev", "--features=log-mdc","--log-mdc-enabled=true", "--log-level=org.keycloak.transaction:debug" })
@Launch({ "start-dev", "--log-mdc-enabled=true", "--log-level=org.keycloak.transaction:debug" })
void testLogMdcShowingInTheLogs(CLIResult cliResult) {
when().get("http://127.0.0.1:8080/realms/master/.well-known/openid-configuration").then()

View File

@ -256,6 +256,10 @@ Logging:
The log level of a category. Takes precedence over the 'log-level' option.
Possible values are (case insensitive): off, fatal, error, warn, info,
debug, trace, all.
--log-mdc-enabled <true|false>
Indicates whether to add information about the realm and other information to
the mapped diagnostic context. All elements will be prefixed with 'kc.'
Default: false. Available only when log-mdc preview feature is enabled.
Tracing:

View File

@ -258,6 +258,10 @@ Logging:
The log level of a category. Takes precedence over the 'log-level' option.
Possible values are (case insensitive): off, fatal, error, warn, info,
debug, trace, all.
--log-mdc-enabled <true|false>
Indicates whether to add information about the realm and other information to
the mapped diagnostic context. All elements will be prefixed with 'kc.'
Default: false. Available only when log-mdc preview feature is enabled.
Tracing:

View File

@ -98,6 +98,13 @@ Vault:
--vault <provider> Enables a vault provider. Possible values are: file, keystore.
Logging:
--log-mdc-enabled <true|false>
Indicates whether to add information about the realm and other information to
the mapped diagnostic context. All elements will be prefixed with 'kc.'
Default: false. Available only when log-mdc preview feature is enabled.
Tracing:
--tracing-enabled <true|false>

View File

@ -251,6 +251,10 @@ Logging:
The log level of a category. Takes precedence over the 'log-level' option.
Possible values are (case insensitive): off, fatal, error, warn, info,
debug, trace, all.
--log-mdc-enabled <true|false>
Indicates whether to add information about the realm and other information to
the mapped diagnostic context. All elements will be prefixed with 'kc.'
Default: false. Available only when log-mdc preview feature is enabled.
Tracing:

View File

@ -251,6 +251,10 @@ Logging:
The log level of a category. Takes precedence over the 'log-level' option.
Possible values are (case insensitive): off, fatal, error, warn, info,
debug, trace, all.
--log-mdc-enabled <true|false>
Indicates whether to add information about the realm and other information to
the mapped diagnostic context. All elements will be prefixed with 'kc.'
Default: false. Available only when log-mdc preview feature is enabled.
Tracing:

View File

@ -419,6 +419,10 @@ Logging:
The log level of a category. Takes precedence over the 'log-level' option.
Possible values are (case insensitive): off, fatal, error, warn, info,
debug, trace, all.
--log-mdc-enabled <true|false>
Indicates whether to add information about the realm and other information to
the mapped diagnostic context. All elements will be prefixed with 'kc.'
Default: false. Available only when log-mdc preview feature is enabled.
Tracing:

View File

@ -467,6 +467,10 @@ Logging:
The log level of a category. Takes precedence over the 'log-level' option.
Possible values are (case insensitive): off, fatal, error, warn, info,
debug, trace, all.
--log-mdc-enabled <true|false>
Indicates whether to add information about the realm and other information to
the mapped diagnostic context. All elements will be prefixed with 'kc.'
Default: false. Available only when log-mdc preview feature is enabled.
Tracing:

View File

@ -466,6 +466,10 @@ Logging:
The log level of a category. Takes precedence over the 'log-level' option.
Possible values are (case insensitive): off, fatal, error, warn, info,
debug, trace, all.
--log-mdc-enabled <true|false>
Indicates whether to add information about the realm and other information to
the mapped diagnostic context. All elements will be prefixed with 'kc.'
Default: false. Available only when log-mdc preview feature is enabled.
Tracing:

View File

@ -464,6 +464,10 @@ Logging:
The log level of a category. Takes precedence over the 'log-level' option.
Possible values are (case insensitive): off, fatal, error, warn, info,
debug, trace, all.
--log-mdc-enabled <true|false>
Indicates whether to add information about the realm and other information to
the mapped diagnostic context. All elements will be prefixed with 'kc.'
Default: false. Available only when log-mdc preview feature is enabled.
Tracing: