Hive的log默认存放在/tmp/atguigu/hive.log目录下(当前用户名下)

修改hive的log日志到指定的位置上,我打算放到 /root/soft/hive-1.2.1/hive_logs 目录下, 你们随意,

去/root/soft/hive-1.2.1/conf 目录下面修改hive-log4j.properties 文件

修改 hive.log.dir属性配置信息

下面是hive-log4j.properties文件

  1. hive.log.dir=/root/soft/hive-1.2.1/hive_logs
  2. hive.log.file=hive.log
  3. # Define the root logger to the system property "hadoop.root.logger".
  4. log4j.rootLogger=${hive.root.logger}, EventCounter
  5. # Logging Threshold
  6. log4j.threshold=${hive.log.threshold}
  7. #
  8. # Daily Rolling File Appender
  9. #
  10. # Use the PidDailyerRollingFileAppend class instead if you want to use separate log files
  11. # for different CLI session.

修改完了重新执行hive,随便操作点什么

验证结果

  1. [root@zjj101 hive_logs]# cat hive.log
  2. 2020-09-13 17:12:42,572 ERROR [main]: DataNucleus.Datastore (Log4JLogger.java:error(115)) - Error thrown executing ALTER TABLE `PARTITIONS` ADD COLUMN `TBL_ID` BIGINT NULL : Table 'metastore.PARTITIONS' doesn't exist
  3. java.sql.SQLSyntaxErrorException: Table 'metastore.PARTITIONS' doesn't exist
  4. at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
  5. at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
  6. at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
  7. at com.mysql.cj.jdbc.StatementImpl.executeInternal(StatementImpl.java:764)
  8. at com.mysql.cj.jdbc.StatementImpl.execute(StatementImpl.java:648)
  9. at com.jolbox.bonecp.StatementHandle.execute(StatementHandle.java:254)
  10. at org.datanucleus.store.rdbms.table.AbstractTable.executeDdlStatement(AbstractTable.java:760)
  11. at org.datanucleus.store.rdbms.table.AbstractTable.executeDdlStatementList(AbstractTable.java:711)
  12. at org.datanucleus.store.rdbms.table.TableImpl.validateColumns(TableImpl.java:259)
  13. at org.datanucleus.store.rdbms.RDBMSStoreManager$ClassAdder.performTablesValidation(RDBMSStoreManager.java:3393)
  14. at org.datanucleus.store.rdbms.RDBMSStoreManager$ClassAdder.addClassTablesAndValidate(RDBMSStoreManager.java:3190)
  15. at org.datanucleus.store.rdbms.RDBMSStoreManager$ClassAdder.run(RDBMSStoreManager.java:2841)
  16. at org.datanucleus.store.rdbms.AbstractSchemaTransaction.execute(AbstractSchemaTransaction.java:122)
  17. at org.datanucleus.store.rdbms.RDBMSStoreManager.addClasses(RDBMSStoreManager.java:1605)

就能查看到日志了