wurstmeister / kafka-docker

Dockerfile for Apache Kafka
http://wurstmeister.github.io/kafka-docker/
Apache License 2.0
6.92k stars 2.73k forks source link

configuring log level #631

Open crizo23 opened 3 years ago

crizo23 commented 3 years ago

I think this was addressed in this commit ..but I'm not sure if it's working, if the README is wrong, or if I'm not configuring it correctly. Currently, I see lots of INFO level output. I only want to see WARN level output, I've tried the following lines in my docker compose file:

      LOG4J_LOGGER_KAFKA_AUTHORIZER_LOGGER: WARN
      LOG4J_LOGGER_KAFKA_AUTHORIZER_LOGGER: FATAL, authorizerAppender

e.g.

my-kafka-broker-3:
    ....
    environment:
      ....
      KAFKA_BROKER_ID: 3
      LOG4J_LOGGER_KAFKA_AUTHORIZER_LOGGER: WARN, authorizerAppender

but neither seem to have an effect on what's logged.

The only thing I see in the logs pertaining to "logging" are: [Configuring] 'log4j.logger.kafka.authorizer.logger' in '/opt/kafka/config/log4j.properties'

thanks for any help/clarifation

rdlowrey commented 3 years ago

I have the same problem ... not sure if it's E_PEBKAC 🤷

kim-se-yeong commented 2 years ago

Hi, I am using docker image of wurstmeister/kafka:2.13-2.6.0 I am also having the same problem. Have you ever solved this problem?

giovanni-nabil commented 2 years ago

Hi, Using Kafka docker image wurstmeister/kafka:2.13-2.8.1 here.

This config actually does change the property inside opt/kafka/config/log4j.properties and is perfectly working for me, for example, I'd use:

- LOG4J_LOGGER_KAFKA_REQUEST_LOGGER=TRACE, requestAppender

Notice that in my case I used requestAppender which outputs the logs to a file called kafka-request.log, If I wanted to see the logs in console output I'd change the property to LOG4J_LOGGER_KAFKA_REQUEST_LOGGER=TRACE, stdout instead or simply not specify an appender at all, it should default to stdout

In your case authorizerAppender also outputs the logs to a file called kafka-authorizer.log, so it won't have an effect on what's being logged to console output. All the log files can be found under the configured logs directory.

What you want is to adjust the general broker logging levels

- LOG4J_LOGGER_KAFKA=WARN
- LOG4J_LOGGER_ORG_APACHE_KAFKA=WARN
dvdblk commented 1 year ago

Hi, Using Kafka docker image wurstmeister/kafka:2.13-2.8.1 here.

This config actually does change the property inside opt/kafka/config/log4j.properties and is perfectly working for me, for example, I'd use:

- LOG4J_LOGGER_KAFKA_REQUEST_LOGGER=TRACE, requestAppender

Notice that in my case I used requestAppender which outputs the logs to a file called kafka-request.log, If I wanted to see the logs in console output I'd change the property to LOG4J_LOGGER_KAFKA_REQUEST_LOGGER=TRACE, stdout instead or simply not specify an appender at all, it should default to stdout

In your case authorizerAppender also outputs the logs to a file called kafka-authorizer.log, so it won't have an effect on what's being logged to console output. All the log files can be found under the configured logs directory.

What you want is to adjust the general broker logging levels

- LOG4J_LOGGER_KAFKA=WARN
- LOG4J_LOGGER_ORG_APACHE_KAFKA=WARN

Using wurstmeister/kafka:2.13-2.8.1 and added

- LOG4J_LOGGER_KAFKA=WARN
- LOG4J_LOGGER_ORG_APACHE_KAFKA=WARN

into a docker compose. Can still see every single log including INFO :/