1.8 Hive运行日志配置和查看

一、配置文件

1、重命名配置文件

#
把/opt/modules/hive-0.13.1/conf/hive-log4j.properties.template重命名为hive-log4j.properties

#重新进入hive
[root@hadoop-senior hive-0.13.1]# bin/hive
Logging initialized using configuration in file:/opt/modules/hive-0.13.1/conf/hive-log4j.properties    #此时加载的配置文件就是重命名后的
hive (default)>

2、配置log目录

#创建log目录
[root@hadoop-senior hive-0.13.1]# pwd
/opt/modules/hive-0.13.1

[root@hadoop-senior hive-0.13.1]# mkdir logs


#配置进文件
hive.log.dir=/opt/modules/hive-0.13.1/logs    #找到此行,改为这样


#此时重新进入一下hive,log文件就生成了
[root@hadoop-senior logs]# ls
hive.log

2、命令行设置

#进入hive的命令行其实也可以设置很多值;
#直接打如下命令,就会显示很多当前设置的值;
hive (default)> set;


#bin/hive命令
直接用bin/hive命令也可以设置值;
[root@hadoop-senior hive-0.13.1]# bin/hive -h    #看帮助
Missing argument for option: h
usage: hive
 -d,--define <key=value>          Variable subsitution to apply to hive
                                  commands. e.g. -d A=B or --define A=B
    --database <databasename>     Specify the database to use
 -e <quoted-query-string>         SQL from command line
 -f <filename>                    SQL from files
 -H,--help                        Print help information
 -h <hostname>                    connecting to Hive Server on remote host
    --hiveconf <property=value>   Use value for given property
    --hivevar <key=value>         Variable subsitution to apply to hive
                                  commands. e.g. --hivevar A=B
 -i <filename>                    Initialization SQL file
 -p <port>                        connecting to Hive Server on port number
 -S,--silent                      Silent mode in interactive shell
 -v,--verbose                     Verbose mode (echo executed SQL to the
                                  console)


#使用
[root@hadoop-senior hive-0.13.1]# bin/hive --hiveconf hive.root.logger=INFO,console    #设置日志级别,console;让日志可以显示在命令行(详细的)
原文地址:https://www.cnblogs.com/weiyiming007/p/10735562.html