Skip to content

Lower Kafka ConsumerConfig log level#14134

Closed
nevillelyh wants to merge 1 commit intotrinodb:masterfrom
nevillelyh:neville/kafka-logging
Closed

Lower Kafka ConsumerConfig log level#14134
nevillelyh wants to merge 1 commit intotrinodb:masterfrom
nevillelyh:neville/kafka-logging

Conversation

@nevillelyh
Copy link
Copy Markdown
Member

@nevillelyh nevillelyh commented Sep 14, 2022

Description

KafkaConsumer logs ConsumerConfig via AbstractConfig on object creation and pollutes Trino logging.

This change lowers ConsumerConfig log level.

AbstractConfig has a constructor with boolean doLog but it's not exposed through ConsumerConfig. And there doesn't seem to be an easy way to configure j.u.Logger within a module. Airlift log-manager's has a Logging.setLevel that might do the job but it's used tests only. Any idea why?

Non-technical explanation

Make Kafka connector logging less verbose.

Release notes

(x) This is not user-visible and no release notes are required.
( ) Release notes are required, please propose a release note for me.
( ) Release notes are required, with the following suggested text:

# Section
* Fix some things. ({issue}`issuenumber`)

@cla-bot cla-bot bot added the cla-signed label Sep 14, 2022
@nevillelyh nevillelyh force-pushed the neville/kafka-logging branch from 8a5faf0 to be8db30 Compare September 14, 2022 21:31
@nevillelyh nevillelyh changed the title Suppress Kafka ConsumerConfig logs Lower Kafka ConsumerConfig log level Sep 14, 2022
{
default KafkaConsumer<byte[], byte[]> create(ConnectorSession session)
{
Logger.getLogger(ConsumerConfig.class.getName()).setLevel(Level.WARNING);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We cannot do it like that.

First it would have to be done once per connector initialization so somewhere in the io.trino.plugin.kafka.KafkaConnectorFactory#create.
Also if set logging statically then you would override anything that is set via https://trino.io/docs/current/admin/properties-logging.html.

So I think we need to disable logging in tests. Somewhere here io.trino.plugin.kafka.KafkaQueryRunnerBuilder#build and update docs to mention that it is a good practice to set this in log.properties so your log file is less polluted.

I would do it as two PRs as they require different people for review.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Also if set logging statically then you would override anything that is set via https://trino.io/docs/current/admin/properties-logging.html.
Yeah I was looking for alternatives like a connector level conf file but can't find any. Didn't want to change the default log.properties.

So instead of hard coding it here, we just have to document how to suppress this & hard code setLevel in tests, right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Also looks like Kafka logging is already suppressed in KafkaQueryRunnerBuilder. So this should be a doc change only?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

So this should be a doc change only?

Yes, it looks like that. There also product tests where we can implement this suggestion. So we can avoid poluting logs in product tests.
See io.trino.tests.product.launcher.env.common.Kafka where we could have log.properties file that is used.

Please reach to @andrewdibiasio6 or @lukasz-walkiewicz to help you run product tests for kafka here.

Copy link
Copy Markdown
Member Author

@nevillelyh nevillelyh Sep 15, 2022

Choose a reason for hiding this comment

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

@nevillelyh nevillelyh closed this Sep 15, 2022
@nevillelyh nevillelyh deleted the neville/kafka-logging branch September 15, 2022 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants