Enable Debug mode in beeline

  • 0

Enable Debug mode in beeline

Some time you have to troubleshoot beeline issue and then you think how to get into debug mode for beeline command shell as you have in hive (-hiveconf hive.root.logger=Debug,console). I know same is not going to work with beeline
So don’t worry following steps will help you and good part is you do not need to restart the hiveserve2.

Step 1: Login to your server and check whether you have beeline-log4j.properties file in /etc/hive/conf/ or not if not then copy the Beeline log4j property file from the given template.

[s0998dnz@m1.hdp22 ~]$ ll /etc/hive/conf/beeline-log4j.properties
ls: cannot access /etc/hive/conf/beeline-log4j.properties: No such file or directory
[s0998dnz@m1.hdp22 ~]$ ll /etc/hive/conf/beeline-log4j.properties.template
-rw-r--r-- 1 root root 1139 Nov 19  2014 /etc/hive/conf/beeline-log4j.properties.template
[s0998dnz@m1.hdp22 ~]$ cp /etc/hive/conf/beeline-log4j.properties.template /etc/hive/conf/beeline-log4j.properties
cp: cannot create regular file `/etc/hive/conf/beeline-log4j.properties': Permission denied
[s0998dnz@m1.hdp22 ~]$ sudo su - hive
[hive@m1.hdp22 ~]$ cp /etc/hive/conf/beeline-log4j.properties.template /etc/hive/conf/beeline-log4j.properties
[hive@m1.hdp22 ~]$ ll /etc/hive/conf/beeline-log4j.properties
-rw-r--r-- 1 hive hadoop 1139 May 31 03:34 /etc/hive/conf/beeline-log4j.properties
[hive@m1.hdp22 ~]$ cat /etc/hive/conf/beeline-log4j.properties
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

log4j.rootLogger=WARN, console

######## console appender ########
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.target=System.err
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} [%t]: %p %c{2}: %m%n
log4j.appender.console.encoding=UTF-8
[hive@m1.hdp22 ~]$

Step 2: Now open /etc/hive/conf/beeline-log4j.properties and change log4j.rootLogger from WARN/INFO to DEBUG, console.
log4j.rootLogger=DEBUG, console

Save the changes, run Beeline client and debug output should be displayed.

Please feel free to give your valuable feedback or suggestion.


Leave a Reply