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.

  • 相关阅读:
    MSIL实用指南-一维数组的操作
    MSIL实用指南-给字段、属性、方法、类、程序集加Attribute
    MSIL实用指南-比较运算
    MSIL实用指南-逻辑运算
    MSIL实用指南-位运算
    MSIL实用指南-数学运算
    MSIL实用指南-创建对象
    MSIL实用指南-装箱拆箱
    MSIL实用指南-生成构造函数
    K8S从入门到放弃系列-(5)kubernetes集群之kube-apiserver部署
  • 原文地址:https://www.cnblogs.com/machong/p/5919063.html
Copyright © 2011-2022 走看看