KAFKA-18853 Add documentation to remind users to use valid LogLevelConfig constants (#20249)

This PR aims to add documentation to `alterLogLevelConfigs` method to
remind users to use valid LogLevelConfig constants.

Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
This commit is contained in:
jimmy 2025-08-27 10:52:02 +08:00 committed by GitHub
parent 08057eac53
commit 5fcbf3d3b1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 14 additions and 0 deletions

View File

@ -26,6 +26,20 @@ import java.util.stream.Collectors;
/** /**
* A class representing an alter configuration entry containing name, value and operation type. * A class representing an alter configuration entry containing name, value and operation type.
* <p>
* <b>Note for Broker Logger Configuration:</b><br>
* When altering broker logger levels (using {@link org.apache.kafka.common.config.ConfigResource.Type#BROKER_LOGGER}),
* it is strongly recommended to use log level constants from {@link org.apache.kafka.common.config.LogLevelConfig} instead of string literals.
* This ensures compatibility with Kafka's log level validation and avoids potential configuration errors.
* <p>
* Example:
* <pre>
* Recommended approach:
* new AlterConfigOp(new ConfigEntry(loggerName, LogLevelConfig.DEBUG_LOG_LEVEL), OpType.SET)
*
* Avoid this:
* new AlterConfigOp(new ConfigEntry(loggerName, "DEBUG"), OpType.SET)
* </pre>
*/ */
public class AlterConfigOp { public class AlterConfigOp {