zoukankan      html  css  js  c++  java
  • Storm的log问题


    由于storm-core本身含有了 logback的相关依赖包,所以要排除掉

    <dependency>
        <groupId>org.apache.storm</groupId>
        <artifactId>storm-core</artifactId>
        <version>${storm-core-version}</version>
        <scope>compile</scope>
        <exclusions>
            <exclusion>
                <artifactId>logback-classic</artifactId>
                <groupId>ch.qos.logback</groupId>
            </exclusion>
            <exclusion>
                <artifactId>logback-core</artifactId>
                <groupId>ch.qos.logback</groupId>
            </exclusion>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>log4j-over-slf4j</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    在自己的工程里引入下面的dependency,同时,需要src下面加入 log4j.properties

    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>1.6.0</version>
    </dependency>

    下面是过程中遇到的几个错误,原文写的很详细。

    SLF4J的警告或错误信息
    SLF4J warning or error messages and their meanings
    http://www.slf4j.org/codes.html

    错误:Failed to load class org.slf4j.impl.StaticLoggerBinder

    解决方法:

    This warning message is reported when the org.slf4j.impl.StaticLoggerBinder class could not be loaded into memory.

    This happens when no appropriate SLF4J binding could be found on the class path. Placing one (and only one) of slf4j-nop.jar, slf4j-simple.jar, slf4j-log4j12.jar, slf4j-jdk14.jar or logback-classic.jar on the class path should solve the problem.

    错误:Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path

    解决方法:

    The purpose of slf4j-log4j12 module is to delegate or redirect calls made to an SLF4J logger to log4j.

    The purpose of the log4j-over-slf4j module is to redirect calls made to a log4j logger to SLF4J.

    If SLF4J is bound with slf4j-log4j12.jar and log4j-over-slf4j.jar is also present on the class path, a StackOverflowError will inevitably occur immediately after the first invocation of an SLF4J or a log4j logger.

  • 相关阅读:
    协成
    java设计模式之中介者模式
    java设计模式之状态模式
    java设计模式之命令模式
    java设计模式之迭代器模式
    java设计模式之模板方法模式
    /ppp profile up-down script 的变量
    iptables常用配置
    站群服务器多IP配置L2TP多出口
    ARCH LINUX 配置DHCPCD 静态IP
  • 原文地址:https://www.cnblogs.com/machong/p/5919063.html
Copyright © 2011-2022 走看看