Help Center/ MapReduce Service/ User Guide (ME-Abu Dhabi Region)/ Troubleshooting/ Using Kafka/ Configuring Logs for Shell Commands on the Client
Updated on 2022-12-08 GMT+08:00

Configuring Logs for Shell Commands on the 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)
    [2017-02-17 14:34:27,013] INFO Client environment:zookeeper.version=V100R002C10, built on 05/12/2016 08:56 GMT (org.apache.zookeeper.ZooKeeper)
    [2017-02-17 14:34:27,013] INFO Client environment:host.name=10-10-144-2 (org.apache.zookeeper.ZooKeeper)
    [2017-02-17 14:34:27,013] INFO Client environment:java.version=1.8.0_72 (org.apache.zookeeper.ZooKeeper)
    [2017-02-17 14:34:27,013] INFO Client environment:java.vendor=Oracle Corporation (org.apache.zookeeper.ZooKeeper)
    [2017-02-17 14:34:27,013] INFO Client environment:java.home=/opt/client/JDK/jdk/jre (org.apache.zookeeper.ZooKeeper)
    Test
    __consumer_offsets
    counter
    test
    test2
    test3
    test4