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.

  • 相关阅读:
    值得 Web 开发人员学习的20个 jQuery 实例教程
    15款优雅的 WordPress 电子商务网站主题
    Red Pen
    经典网页设计:无缝过渡的响应式设计案例
    值得 Web 开发人员收藏的20个 HTML5 实例教程
    mysql分库 分表
    MySQL大数据量快速分页实现
    mysql全局唯一ID生成方案(二)
    使用 SendARP 获取 MAC 地址(使用SendARP API函数,很多相关文章)
    锁是用来解决并发问题
  • 原文地址:https://www.cnblogs.com/machong/p/5919063.html
Copyright © 2011-2022 走看看