Community Articles

Find and share helpful community-sourced technical articles.
Announcements
Celebrating as our community reaches 100,000 members! Thank you!
Labels (1)
avatar

It would sometimes be useful to adjust the log level when executing hive commands from command line without having to restart components. This article explains how that can be achieved:

You can provide the log level on the command line to hive as follows

hive -hiveconf hive.root.logger=DEBUG,console -e "show tables ;"

For example:

# hive -hiveconf hive.root.logger=DEBUG,console -e "show tables ;" |more

16/12/24 15:10:23 DEBUG util.VersionInfo: version: 2.7.3.2.5.3.0-37
16/12/24 15:10:27 [main]: DEBUG common.LogUtils: Using hive-site.xml found on CLASSPATH at /etc/hive/2.5.3.0-37/0/hive-site.xml
16/12/24 15:10:27 [main]: DEBUG session.SessionState: SessionState user: null
Logging initialized using configuration in file:/etc/hive/2.5.3.0-37/0/hive-log4j.properties
16/12/24 15:10:27 [main]: INFO SessionState: 
Logging initialized using configuration in file:/etc/hive/2.5.3.0-37/0/hive-log4j.properties
16/12/24 15:10:27 [main]: DEBUG parse.VariableSubstitution: Substitution is on: hive
16/12/24 15:10:27 [main]: DEBUG lib.MutableMetricsFactory: field org.apache.hadoop.metrics2.lib.MutableRate org.apache.hadoop.security.UserGroupInformation$UgiMetrics.loginSuccess with annotation @org.apache.hadoop.metrics2.annotation.Metric(about=, sampleName=Ops, always=false, type=DEFAULT, valueName=Time, value=[Rate of successful kerberos logins and latency (milliseconds)])
16/12/24 15:10:27 [main]: DEBUG lib.MutableMetricsFactory: field org.apache.hadoop.metrics2.lib.MutableRate org.apache.hadoop.security.UserGroupInformation$UgiMetrics.loginFailure with annotation @org.apache.hadoop.metrics2.annotation.Metric(about=, sampleName=Ops, always=false, type=DEFAULT, valueName=Time, value=[Rate of failed kerberos logins and latency (milliseconds)])
16/12/24 15:10:27 [main]: DEBUG lib.MutableMetricsFactory: field org.apache.hadoop.metrics2.lib.MutableRate org.apache.hadoop.security.UserGroupInformation$UgiMetrics.getGroups with annotation @org.apache.hadoop.metrics2.annotation.Metric(about=, sampleName=Ops, always=false, type=DEFAULT, valueName=Time, value=[GetGroups])

This can be especially useful if your hive cli is hanging or slow connecting.

Note, the following log levels are supported: ALL DEBUG ERROR FATAL INFO OFF TRACE TRACE_INT WARN

4,749 Views