SLF4J: Hbase和Flume的slf4j-log4j12-x.x.xx.jar与hadoop的slf4j-log4j12-x.x.xx.jar冲突

时间:2023-02-19 13:09:00

SLF4J: Hbase和Flume的slf4j-log4j12-x.x.xx.jar与hadoop的slf4j-log4j12-x.x.xx.jar冲突



一、实验环境

  • Ubuntu16.04
  • Flume1.7.0
  • Hbase1.1.5
  • Hadoop2.7.1

二、报错信息

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/local/flume-1.7.0/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/local/hadoop-2.7.1/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/local/hbase-1.1.5/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
log4j:WARN No appenders could be found for logger (org.apache.flume.node.PollingPropertiesFileConfigurationProvider).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

三、报错分析及解决方案

Hbase和Flume的slf4j-log4j12-x.x.xx.jar与hadoop的slf4j-log4j12-x.x.xx.jar冲突(版本不一致)

​查询​​​并​​「删掉」​​​或者​​「修改」​​命名,如下图:

SLF4J: Hbase和Flume的slf4j-log4j12-x.x.xx.jar与hadoop的slf4j-log4j12-x.x.xx.jar冲突

重新开启Flume客户端监听

bin/flume-ng agent --conf conf/ --name a1 --conf-file job/flume-netcat-logger.conf -Dflume.root.logger = INFO,console

监听启动不成功:

log4j:WARN No appenders could be found for logger (org.apache.flume.node.PollingPropertiesFileConfigurationProvider).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

注意

bin/flume-ng agent --conf conf/ --name a1 --conf-file job/flume-netcat-logger.conf -Dflume.root.logger=INFO,console

-Dflume.root.logger=INFO,console 的等号两边不能有空格

SLF4J: Hbase和Flume的slf4j-log4j12-x.x.xx.jar与hadoop的slf4j-log4j12-x.x.xx.jar冲突