Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-9881

enabling HBASE_ROOT_LOGGER in hbase-env.sh would suppress the hbase console output

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Trivial
    • Resolution: Not A Problem
    • 0.96.0
    • None
    • None
    • None

    Description

      Currently, there seems two call paths to determine the value of hbase.root.logger in log4j.properties file.

      1. hbase -> hbase-config.sh -> hbase-env.sh (set HBASE_ROOT_LOGGER if any) -> hbase (set default value to HBASE_ROOT_LOGGER if no variable declared)

      2. hbase-daemon.sh -> hbase-config.sh -> hbase-env.sh (set HBASE_ROOT_LOGGER if any) -> hbase-daemon.sh (set default value to HBASE_ROOT_LOGGER if no variable declared)

      We found an issue at call path#1, while using 'bin/hbase' the original console output will redirect to the log file if the HBASE_ROOT_LOGGER enabled in hbase-env.sh

      for example
      1. we use 'bin/hbase zkcli' to connect to zookeeper, will see following log output to the console...

      # bin/hbase zkcli
      Connecting to scottm-hbase-1.lab:2181
      2013-11-04 08:33:39,855 INFO  [main] zookeeper.ZooKeeper: Client environment:zookeeper.version=3.4.5-1392090, built on 09/30/2012 17:52 GMT
      2013-11-04 08:33:39,855 INFO  [main] zookeeper.ZooKeeper: Client environment:host.name=scottm-hbase-1.lab
      2013-11-04 08:33:39,856 INFO  [main] zookeeper.ZooKeeper: Client environment:java.version=1.6.0_26
      2013-11-04 08:33:39,856 INFO  [main] zookeeper.ZooKeeper: Client environment:java.vendor=Sun Microsystems Inc.
      2013-11-04 08:33:39,856 INFO  [main] zookeeper.ZooKeeper: Client environment:java.home=/usr/java/jdk1.6.0_26/jre
      2013-11-04 08:33:39,856 INFO  [main] zookeeper.ZooKeeper: Client environment:java.class.path=/opt/hbase/bin/../conf:/usr/java/jdk1.6.0_26/lib/tools.jar:/opt/hbase/bin/..:/opt/hbase/bin/../lib/activation-1.1.jar:/opt/hbase/bin/../lib/asm-3.1.jar:/opt/hbase/bin/../lib/commons-beanutils-1.7.0.jar:/opt/hbase/bin/../lib/commons-beanutils-core-1.8.0.jar:/opt/hbase/bin/../lib/commons-cli-1.2.jar:/opt/hbase/bin/../lib/commons-codec-1.7.jar:/opt/hbase/bin/../lib/commons-collections-3.2.1.jar:/opt/hbase/bin/../lib/commons-configuration-1.6.jar:/opt/hbase/bin/../lib/commons-digester-1.8.jar:/opt/hbase/bin/../lib/commons-el-1.0.jar:/opt/hbase/bin/../lib/commons-httpclient-3.1.jar:/opt/hbase/bin/../lib/commons-io-2.4.jar:/opt/hbase/bin/../lib/commons-lang-2.6.jar:/opt/hbase/bin/../lib/commons-logging-1.1.1.jar:/opt/hbase/bin/../lib/commons-math-2.2.jar:/opt/hbase/bin/../lib/commons-net-1.4.1.jar:/opt/hbase/bin/../lib/core-3.1.1.jar:/opt/hbase/bin/../lib/findbugs-annotations-1.3.9-1.jar:/opt/hbase/bin/../lib/guava-12.0.1.jar:/opt/hbase/bin/../lib/hadoop-core-1.2.1.jar:/opt/hbase/bin/../lib/hamcrest-core-1.3.jar:/opt/hbase/bin/../lib/hbase-client-0.97.0-hadoop1-SNAPSHOT-SNAPSHOT.jar:/opt/hbase/bin/../lib/hbase-common-0.97.0-hadoop1-SNAPSHOT-SNAPSHOT.jar:/opt/hbase/bin/../lib/hbase-common-0.97.0-hadoop1-SNAPSHOT-SNAPSHOT-tests.jar:/opt/hbase/bin/../lib/hbase-examples-0.97.0-hadoop1-SNAPSHOT-SNAPSHOT.jar:/opt/hbase/bin/../lib/hbase-hadoop1-compat-0.97.0-hadoop1-SNAPSHOT-SNAPSHOT.jar:/opt/hbase/bin/../lib/hbase-hadoop-compat-0.97.0-hadoop1-SNAPSHOT-SNAPSHOT.jar:/opt/hbase/bin/../lib/hbase-it-0.97.0-hadoop1-SNAPSHOT-SNAPSHOT.jar:/opt/hbase/bin/../lib/hbase-it-0.97.0-hadoop1-SNAPSHOT-SNAPSHOT-tests.jar:/opt/hbase/bin/../lib/hbase-prefix-tree-0.97.0-hadoop1-SNAPSHOT-SNAPSHOT.jar:/opt/hbase/bin/../lib/hbase-protocol-0.97.0-hadoop1-SNAPSHOT-SNAPSHOT.jar:/opt/hbase/bin/../lib/hbase-server-0.97.0-hadoop1-SNAPSHOT-SNAPSHOT.jar:/opt/hbase/bin/../lib/hbase-server-0.97.0-hadoop1-SNAPSHOT-SNAPSHOT-tests.jar:/opt/hbase/bin/../lib/hbase-shell-0.97.0-hadoop1-SNAPSHOT-SNAPSHOT.jar:/opt/hbase/bin/../lib/hbase-testing-util-0.97.0-hadoop1-SNAPSHOT-SNAPSHOT.jar:/opt/hbase/bin/../lib/hbase-thrift-0.97.0-hadoop1-SNAPSHOT-SNAPSHOT.jar:/opt/hbase/bin/../lib/high-scale-lib-1.1.1.jar:/opt/hbase/bin/../lib/htrace-core-2.01.jar:/opt/hbase/bin/../lib/httpclient-4.1.3.jar:/opt/hbase/bin/../lib/httpcore-4.1.3.jar:/opt/hbase/bin/../lib/jackson-core-asl-1.8.8.jar:/opt/hbase/bin/../lib/jackson-jaxrs-1.8.8.jar:/opt/hbase/bin/../lib/jackson-mapper-asl-1.8.8.jar:/opt/hbase/bin/../lib/jackson-xc-1.8.8.jar:/opt/hbase/bin/../lib/jamon-runtime-2.3.1.jar:/opt/hbase/bin/../lib/jasper-compiler-5.5.23.jar:/opt/hbase/bin/../lib/jasper-runtime-5.5.23.jar:/opt/hbase/bin/../lib/jaxb-api-2.2.2.jar:/opt/hbase/bin/../lib/jaxb-impl-2.2.3-1.jar:/opt/hbase/bin/../lib/jersey-core-1.8.jar:/opt/hbase/bin/../lib/jersey-json-1.8.jar:/opt/hbase/bin/../lib/jersey-server-1.8.jar:/opt/hbase/bin/../lib/jettison-1.3.1.jar:/opt/hbase/bin/../lib/jetty-6.1.26.jar:/opt/hbase/bin/../lib/jetty-sslengine-6.1.26.jar:/opt/hbase/bin/../lib/jetty-util-6.1.26.jar:/opt/hbase/bin/../lib/jruby-complete-1.6.8.jar:/opt/hbase/bin/../lib/jsp-2.1-6.1.14.jar:/opt/hbase/bin/../lib/jsp-api-2.1-6.1.14.jar:/opt/hbase/bin/../lib/jsr305-1.3.9.jar:/opt/hbase/bin/../lib/junit-4.11.jar:/opt/hbase/bin/../lib/libthrift-0.9.0.jar:/opt/hbase/bin/../lib/log4j-1.2.17.jar:/opt/hbase/bin/../lib/metrics-core-2.1.2.jar:/opt/hbase/bin/../lib/netty-3.6.6.Final.jar:/opt/hbase/bin/../lib/protobuf-java-2.5.0.jar:/opt/hbase/bin/../lib/servlet-api-2.5-6.1.14.jar:/opt/hbase/bin/../lib/slf4j-api-1.6.4.jar:/opt/hbase/bin/../lib/slf4j-log4j12-1.6.4.jar:/opt/hbase/bin/../lib/stax-api-1.0.1.jar:/opt/hbase/bin/../lib/xmlenc-0.52.jar:/opt/hbase/bin/../lib/zookeeper-3.4.5.jar:2013-11-04 08:33:39,858 INFO  [main] zookeeper.ZooKeeper: Client environment:java.library.path=/usr/java/jdk1.6.0_26/jre/lib/amd64/server:/usr/java/jdk1.6.0_26/jre/lib/amd64:/usr/java/jdk1.6.0_26/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
      2013-11-04 08:33:39,858 INFO  [main] zookeeper.ZooKeeper: Client environment:java.io.tmpdir=/tmp
      2013-11-04 08:33:39,858 INFO  [main] zookeeper.ZooKeeper: Client environment:java.compiler=<NA>
      2013-11-04 08:33:39,858 INFO  [main] zookeeper.ZooKeeper: Client environment:os.name=Linux
      2013-11-04 08:33:39,859 INFO  [main] zookeeper.ZooKeeper: Client environment:os.arch=amd64
      2013-11-04 08:33:39,859 INFO  [main] zookeeper.ZooKeeper: Client environment:os.version=2.6.18-164.el5xen
      2013-11-04 08:33:39,859 INFO  [main] zookeeper.ZooKeeper: Client environment:user.name=root
      2013-11-04 08:33:39,859 INFO  [main] zookeeper.ZooKeeper: Client environment:user.home=/root
      2013-11-04 08:33:39,859 INFO  [main] zookeeper.ZooKeeper: Client environment:user.dir=/opt/hbase-0.97.0-hadoop1-SNAPSHOT-SNAPSHOT
      2013-11-04 08:33:39,861 INFO  [main] zookeeper.ZooKeeper: Initiating client connection, connectString=scottm-hbase-1.lab:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@2efb56b1
      2013-11-04 08:33:40,026 INFO  [main-SendThread(scottm-hbase-1.lab:2181)] zookeeper.ClientCnxn: Opening socket connection to server scottm-hbase-1.lab/10.1.145.175:2181. Will not attempt to authenticate using SASL (Unable to locate a login configuration)
      2013-11-04 08:33:40,034 INFO  [main-SendThread(scottm-hbase-1.lab:2181)] zookeeper.ClientCnxn: Socket connection established to scottm-hbase-1.lab/10.1.145.175:2181, initiating session
      Welcome to ZooKeeper!
      JLine support is enabled
      2013-11-04 08:33:40,310 INFO  [main-SendThread(scottm-hbase-1.lab:2181)] zookeeper.ClientCnxn: Session establishment complete on server scottm-hbase-1.lab/10.1.145.175:2181, sessionid = 0x14221eebeb70017, negotiated timeout = 30000
      
      WATCHER::
      
      WatchedEvent state:SyncConnected type:None path:null
      [zk: scottm-hbase-1.lab:2181(CONNECTED) 0]
      

      2. then we enable the HBASE_ROOT_LOGGER in hbase-env.sh

      129 # HBASE_ROOT_LOGGER=INFO,DRFA
      

      remove pound sign to enable the HBASE_ROOT_LOGGER

      129 HBASE_ROOT_LOGGER=INFO,DRFA
      

      3. and re-issue the 'bin/hbase zkcli' again, we will see the logging msg disappear in console output

      bin/hbase zkcli
      Connecting to scottm-hbase-1.lab:2181
      Welcome to ZooKeeper!
      JLine support is enabled
      
      WATCHER::
      
      WatchedEvent state:SyncConnected type:None path:null
      [zk: scottm-hbase-1.lab:2181(CONNECTED) 0]
      

      The reason is that the HBASE_ROOT_LOGGER in hbase-env.sh over-writes the HBASE_ROOT_LOGGER in hbase shell file

      put the egrep results for HBASE_ROOT_LOGGER for reference.

      $ egrep -in --color "HBASE_[a-zA-Z]+_LOGGER" conf/*
      conf/hbase-env.sh:127:# HBASE_ROOT_LOGGER to "<DESIRED_LOG LEVEL>,DRFA".
      conf/hbase-env.sh:129:# HBASE_ROOT_LOGGER=INFO,DRFA
      
      $ egrep -in --color "HBASE_[a-zA-Z]+_LOGGER" bin/*
      bin/hbase:47:#   HBASE_ROOT_LOGGER The root appender. Default is INFO,console
      bin/hbase:345:HBASE_OPTS="$HBASE_OPTS -Dhbase.root.logger=${HBASE_ROOT_LOGGER:-INFO,console}"
      bin/hbase:353:  HBASE_OPTS="$HBASE_OPTS -Dhbase.security.logger=${HBASE_SECURITY_LOGGER:-INFO,RFAS}"
      bin/hbase:355:  HBASE_OPTS="$HBASE_OPTS -Dhbase.security.logger=${HBASE_SECURITY_LOGGER:-INFO,NullAppender}"
      …
      bin/hbase-daemon.sh:147:export HBASE_ROOT_LOGGER=${HBASE_ROOT_LOGGER:-"INFO,RFA"}
      bin/hbase-daemon.sh:148:export HBASE_SECURITY_LOGGER=${HBASE_SECURITY_LOGGER:-"INFO,RFAS"}
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              takeshi.miao takeshi.miao
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: