使用logback / slf4j时抛出异常 [英] Exception thrown while using logback/slf4j

查看:249
本文介绍了使用logback / slf4j时抛出异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用slf4j 1.6.2 api jar(也尝试使用1.6.1) - logback版本是0.9.29(核心和经典)。我在ubuntu上使用jdk1.6。我收到的异常复制如下。

I am using slf4j 1.6.2 api jar (tried using 1.6.1 as well) - logback version is 0.9.29 (core & classic). I am using jdk1.6 on ubuntu. The exception I received is copied below.

Exception in thread "main" java.lang.NoSuchMethodError: org.slf4j.helpers.MessageFormatter.arrayFormat(Ljava/lang/String;[Ljava/lang/Object;)Lorg/slf4j/helpers/FormattingTuple;
    at ch.qos.logback.classic.spi.LoggingEvent.<init>(LoggingEvent.java:112)
    at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:471)
    at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:427)
    at ch.qos.logback.classic.Logger.info(Logger.java:631)

我也收到一条抱怨slf4j绑定不匹配的消息。

I am also getting a message complaining about slf4j binding mismatch.

"SLF4J: The requested version 1.6 by your slf4j binding is not compatible with [1.5.5, 1.5.6, 1.5.7, 1.5.8, 1.5.9, 1.5.10, 1.5.11]"


推荐答案

看起来JVM加载的slf4j-api.jar版本的版本为1.5.x.你的类路径上肯定有slf4j-api-1.5.x.jar(除了slf4j-api-1.6.2.jar)。检查你的课程路径。

It very much looks like the version of slf4j-api.jar being loaded by the JVM has version 1.5.x. You surely have slf4j-api-1.5.x.jar on your class path (in addition to slf4j-api-1.6.2.jar). Check your class path.

这篇关于使用logback / slf4j时抛出异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆