首页 > 解决方案 > DataProc 上 Spark/Hive 中的意外日志条目

问题描述

我正在 DataProc 中运行火花作业。我正在使用工作中的 Hive 连接。

为了我自己的需要,我想以 JSON 格式输出所有日志,并且在当前测试中我配置/etc/spark/conf/log4j.properties了:

log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.target=System.err
log4j.appender.console.layout=org.apache.hadoop.log.Log4Json

这会以 JSON 格式输出 Spark 日志。

现在我在输出中看到了一些奇怪的行:

...
ivysettings.xml file not found in HIVE_HOME or HIVE_CONF_DIR,/etc/hive/conf.dist/ivysettings.xml will be used
{"name":"DependencyResolver","time":1618431755337,"date":"2021-04-14 20:22:35,337","level":"INFO","thread":"nioEventLoopGroup-2-2","message":"ivysettings.xml file not found in HIVE_HOME or HIVE_CONF_DIR,/etc/hive/conf.dist/ivysettings.xml will be used"}

我的假设是非 JSON 行是 Hive 日志输出,实现为:

// If HIVE_HOME is not defined or file is not found in HIVE_HOME/conf then load default ivysettings.xml from class loader
    if (ivysettingsPath == null || !(new File(ivysettingsPath).exists())) {
      ivysettingsPath = ClassLoader.getSystemResource("ivysettings.xml").getFile();
      _console.printInfo("ivysettings.xml file not found in HIVE_HOME or HIVE_CONF_DIR," + ivysettingsPath + " will be used");
    }

问题是我看不到此输出的配置位置。我找到了2个文件:

  1. /etc/hive/conf/hive-log4j2.properties
  2. /etc/hive/conf/hive-exec-log4j2.properties

并且其中没有一个包含 INFO 输出的配置。

有没有办法以某种集中的方式配置 spark/hadoop/hive 或实现统一的日志记录?

标签: javaapache-sparkhadoophivelog4j

解决方案


推荐阅读