Help Center/ MapReduce Service/ Troubleshooting/ Using Kafka/ Configuring Logs for Shell Commands on the Kafka Client
Updated on 2023-11-30 GMT+08:00

Configuring Logs for Shell Commands on the Kafka Client

Issue

How do I set the log level for shell commands on the client?

Procedure

  1. Log in to the node where the Kafka client is installed as the client installation user.
  2. Switch to the Kafka client installation directory, for example, /opt/client.

    cd /opt/client

  3. Run the following command to switch to the Kafka client configuration directory:

    cd Kafka/kafka/config

  4. Open the tools-log4j.properties file, change WARN to INFO, and save the file.

  5. Switch to the Kafka client installation directory, for example, /opt/client.

    cd /opt/client

  6. Run the following command to configure environment variables:

    source bigdata_env

  7. Run the following command to perform user authentication (skip this step for a cluster in common mode):

    kinit Component service user

  8. Run the following command to switch to the Kafka client installation directory:

    cd Kafka/kafka/bin

  9. Run the following command to obtain the topic information. The log information can be viewed on the console.

    kafka-topics.sh --list --zookeeper 10.5.144.2:2181/kafka
    [2017-02-17 14:34:27,005] INFO JAAS File name: /opt/client/Kafka/./kafka/config/jaas.conf (org.I0Itec.zkclient.ZkClient)
    [2017-02-17 14:34:27,007] INFO Starting ZkClient event thread. (org.I0Itec.zkclient.ZkEventThread)
    ...
    Test
    __consumer_offsets
    counter
    test
    test2
    test3
    test4