Skip to content

[CLI-3530] Only display produce/consume info messages when the verbosity level is at least info#3208

Merged
Steven Gagniere (sgagniere) merged 3 commits intomainfrom
cli-3530
Oct 24, 2025
Merged

[CLI-3530] Only display produce/consume info messages when the verbosity level is at least info#3208
Steven Gagniere (sgagniere) merged 3 commits intomainfrom
cli-3530

Conversation

@sgagniere
Copy link
Member

@sgagniere Steven Gagniere (sgagniere) commented Oct 18, 2025

Release Notes

Breaking Changes

  • PLACEHOLDER

New Features

  • PLACEHOLDER

Bug Fixes

  • confluent kafka topic [produce | consume] now displays log messages at the appropriate verbosity level
  • confluent asyncapi export --consume-examples now displays consumer log messages at the appropriate verbosity level

Checklist

  • I have successfully built and used a custom CLI binary, without linter issues from this PR.
  • I have clearly specified in the What section below whether this PR applies to Confluent Cloud, Confluent Platform, or both.
  • I have verified this PR in Confluent Cloud pre-prod or production environment, if applicable.
  • I have verified this PR in Confluent Platform on-premises environment, if applicable.
  • I have attached manual CLI verification results or screenshots in the Test & Review section below.
  • I have added appropriate CLI integration or unit tests for any new or updated commands and functionality.
  • I confirm that this PR introduces no breaking changes or backward compatibility issues.
  • I have indicated the potential customer impact if something goes wrong in the Blast Radius section below.
  • I have put checkmarks below confirming that the feature associated with this PR is enabled in:
    • Confluent Cloud prod
    • Confluent Cloud stag
    • Confluent Platform
    • Check this box if the feature is enabled for certain organizations only

What

The confluent-kafka-go producer and consumer set the config log_level=6 by default, which corresponds to informational log messages. Since the CLI is not overwriting this, we get messages like:

[thrd:main]: Telemetry client instance id changed from AAAAAAAAAAAAAAAAAAAAAA to ...

when starting the producer or consumer.

This PR sets log_level depending on the verbose flag so that this message only appears when using at least the info level (confluent kafka topic [produce | consume] -vv).

The new log settings are:

  • -v (warn) --> log_level=4 (Warning)
  • -vv (info) --> log_level=6 (Informational)
  • default --> log_level=3 (Error)

-vvv, -vvvv, and --unsafe-trace all set the debug config, which automatically enables log_level=7, so we don't need to manually specify the log_level in those cases.

This applies to both Cloud and On-Prem.

Blast Radius

Minimal: this change only affects the visibility of log information.

References

Test & Review

https://docs.google.com/document/d/1TcTul1nPkT4nvmMQY2ek-faSz26B75HvuXssW5ifVqE/edit?usp=sharing

@sgagniere Steven Gagniere (sgagniere) requested a review from a team as a code owner October 18, 2025 02:27
Copilot AI review requested due to automatic review settings October 18, 2025 02:27
@confluent-cla-assistant
Copy link

🎉 All Contributor License Agreements have been signed. Ready to merge.
Please push an empty commit if you would like to re-run the checks to verify CLA status for all contributors.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adjusts producer/consumer configuration to align emitted Kafka client log messages with selected CLI verbosity.

  • Maps CLI verbosity levels to explicit librdkafka log_level values (error=3, warn=4, info=6).
  • Adds explicit default log_level=3 (errors only) instead of relying on librdkafka’s default (info).
  • Adds clarifying comments referencing syslog-based log levels.

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +339 to +342
case log.WARN:
return configMap.Set("log_level=4") // Warn level and above
case log.INFO:
return configMap.Set("log_level=6") // Info level and above
Copy link

Copilot AI Oct 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Duplicated warn/info log_level mapping logic in both producer and consumer functions. Extract a shared helper (e.g., mapVerbosityToLogLevel) or define named constants for 4 and 6 to reduce repetition and magic numbers.

Copilot uses AI. Check for mistakes.
Comment on lines +354 to +357
case log.WARN:
return configMap.Set("log_level=4") // Warn level and above
case log.INFO:
return configMap.Set("log_level=6") // Info level and above
Copy link

Copilot AI Oct 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Duplicated warn/info log_level mapping logic in both producer and consumer functions. Extract a shared helper (e.g., mapVerbosityToLogLevel) or define named constants for 4 and 6 to reduce repetition and magic numbers.

Copilot uses AI. Check for mistakes.
@sonarqube-confluent

This comment has been minimized.

@sonarqube-confluent
Copy link

Passed

Analysis Details

0 Issues

  • Bug 0 Bugs
  • Vulnerability 0 Vulnerabilities
  • Code Smell 0 Code Smells

Coverage and Duplications

  • Coverage 0.00% Coverage (78.20% Estimated after merge)
  • Duplications No duplication information (0.00% Estimated after merge)

Project ID: cli

View in SonarQube

@sgagniere Steven Gagniere (sgagniere) merged commit 5507072 into main Oct 24, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants