Hadoop:SLF4J:类路径包含多个SLF4J绑定

时间:2017-11-16 12:36:20

标签: java hadoop slf4j

我正在运行一个简单的map reduce程序,输出为avro文件。在本地模式下运行时,我收到SLF4J绑定警告,阻止显示日志详细信息。这使我很难在本地模式下测试我的更改。

以下是项目依赖项:

<dependencies>
        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-mapreduce-client-common</artifactId>
            <version>2.6.0-cdh5.8.5</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-mapreduce-client-core</artifactId>
            <version>2.6.0-cdh5.8.5</version>
        </dependency>
        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-mapreduce-client-jobclient</artifactId>
            <version>2.6.0-cdh5.8.5</version>
        </dependency>
           <dependency>
            <groupId>org.apache.avro</groupId>
            <artifactId>avro</artifactId>
            <version>1.7.6-cdh5.8.3</version>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.avro</groupId>
            <artifactId>avro-mapred</artifactId>
            <version>1.7.6-cdh5.8.3</version>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.avro</groupId>
            <artifactId>avro-tools</artifactId>
            <version>1.7.6-cdh5.8.3</version>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

从其他堆栈跟踪发布中,我运行了对依赖项的检查:

mvn dependency:tree -Dverbose -Dincludes=org.slf4j

并得到以下树:

[INFO] +- org.apache.hadoop:hadoop-mapreduce-client-common:jar:2.6.0-cdh5.8.5:provided (scope not updated to compile)
[INFO] |  +- (org.slf4j:slf4j-api:jar:1.7.5:compile - scope updated from provided; omitted for duplicate)
[INFO] |  \- (org.slf4j:slf4j-log4j12:jar:1.7.5:compile - scope updated from provided; omitted for duplicate)
[INFO] +- org.apache.hadoop:hadoop-mapreduce-client-core:jar:2.6.0-cdh5.8.5:compile
[INFO] |  +- org.apache.hadoop:hadoop-yarn-common:jar:2.6.0-cdh5.8.5:compile
[INFO] |  |  \- (org.slf4j:slf4j-api:jar:1.7.5:compile - omitted for duplicate)
[INFO] |  +- org.slf4j:slf4j-api:jar:1.7.5:compile
[INFO] |  \- org.slf4j:slf4j-log4j12:jar:1.7.5:compile
[INFO] |     \- (org.slf4j:slf4j-api:jar:1.7.5:compile - omitted for duplicate)
[INFO] \- org.apache.hadoop:hadoop-mapreduce-client-jobclient:jar:2.6.0-cdh5.8.5:compile
[INFO]    +- org.apache.hadoop:hadoop-mapreduce-client-shuffle:jar:2.6.0-cdh5.8.5:compile
[INFO]    |  +- org.apache.hadoop:hadoop-yarn-server-common:jar:2.6.0-cdh5.8.5:compile
[INFO]    |  |  \- org.apache.zookeeper:zookeeper:jar:3.4.5-cdh5.8.5:compile
[INFO]    |  |     +- (org.slf4j:slf4j-api:jar:1.7.5:compile - omitted for duplicate)
[INFO]    |  |     \- (org.slf4j:slf4j-log4j12:jar:1.7.5:compile - omitted for duplicate)
[INFO]    |  +- org.apache.hadoop:hadoop-yarn-server-nodemanager:jar:2.6.0-cdh5.8.5:compile
[INFO]    |  |  \- (org.slf4j:slf4j-api:jar:1.7.5:compile - omitted for duplicate)
[INFO]    |  +- (org.slf4j:slf4j-api:jar:1.7.5:compile - omitted for duplicate)
[INFO]    |  \- (org.slf4j:slf4j-log4j12:jar:1.7.5:compile - omitted for duplicate)
[INFO]    +- (org.slf4j:slf4j-api:jar:1.7.5:compile - omitted for duplicate)
[INFO]    \- (org.slf4j:slf4j-log4j12:jar:1.7.5:compile - omitted for duplicate)

对我来说看起来不错,但是没有从跑步中得到错误或信息。

修复此多重绑定还需要什么?

0 个答案:

没有答案