• 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.

  • 相关阅读:
    stringstream复用【原创】
    C++访问权限【原创】
    C++进阶阅读
    程序员的自我修养-装载、链接与库【原创】
    WinDebug 常用命令表【摘】
    重要说明与访问必看
    Beyond Compare V3.2.3 Beta 中文版
    Batch File Rename Utility(文件批量改名软件) 1.1.4231
    Defraggler(磁盘整理软件) V2.21.993 绿色版
    DiskGenius(磁盘分区/数据恢复) 32位 V4.9.1 免费绿色版
  • 原文地址:https://www.cnblogs.com/machong/p/5919063.html
Copyright © 2020-2023  润新知