- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我有一个 Maven 项目,它使用带有 logback 的 slf4j 作为记录器。我可以看到这两个 Artifact 都在我的 Maven 依赖项树项中。但是每当我尝试运行我的项目时,我都会收到提示:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
我查看了链接,上面写着:
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.
我已经将 logback-classic 添加到我的项目中(我使用的是 1.0.9),但我一直提示该消息并且我的日志没有运行。
谁能帮我解决这个问题?谢谢。
更新:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.employee.scheduler</groupId>
<artifactId>rostering</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>nurserostering</name>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<!-- or whatever version you use -->
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<!-- Needed for runExamples.sh and runExamples.bat -->
<addClasspath>true</addClasspath>
<classpathPrefix>../../binaries/</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<executable>java</executable>
<classpathScope>runtime</classpathScope>
<arguments>
<argument>-Xms256m</argument>
<argument>-Xmx1024m</argument>
<argument>-server</argument>
<argument>-cp</argument>
<classpath />
<argument>com.employee.scheduler.nurserostering.app.NurseRosteringApp</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>org.optaplanner</groupId>
<artifactId>optaplanner-core</artifactId>
<version>6.1.0.Final</version>
</dependency>
<dependency>
<groupId>jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.optaplanner</groupId>
<artifactId>optaplanner-benchmark</artifactId>
<version>6.1.0.Final</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.0.9</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.0.9</version>
</dependency>
</dependencies>
这是我的 logback.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2013 JBoss Inc
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<configuration>
<appender name="consoleAppender" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<!-- %l lowers performance -->
<!--<pattern>%d [%t] %-5p %l%n %m%n</pattern>-->
<pattern>%d [%t] %-5p %m%n</pattern>
</encoder>
</appender>
<!--<appender name="fileAppender" class="ch.qos.logback.core.rolling.RollingFileAppender">-->
<!--<file>local/log/optaplannerBenchmark.log</file>-->
<!--<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">-->
<!--<fileNamePattern>local/log/optaplannerBenchmark.%i.log.zip</fileNamePattern>-->
<!--<minIndex>1</minIndex>-->
<!--<maxIndex>3</maxIndex>-->
<!--</rollingPolicy>-->
<!--<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">-->
<!--<maxFileSize>5MB</maxFileSize>-->
<!--</triggeringPolicy>-->
<!--<encoder>-->
<!--<!– %l lowers performance –>-->
<!--<!–<pattern>%d [%t] %-5p %l%n %m%n</pattern>–>-->
<!--<pattern>%d [%t] %-5p %m%n</pattern>-->
<!--</encoder>-->
<!--</appender>-->
<logger name="org.optaplanner" level="debug"/>
<logger name="com.employee.scheduler" level="debug"/>
<root level="warn">
<appender-ref ref="consoleAppender" />
<!--<appender-ref ref="fileAppender" />-->
</root>
</configuration>
我如何在我的程序中使用它:
public class SolutionBusiness {
protected final transient Logger logger = LoggerFactory.getLogger(getClass());
// some other codes
public void doMove(Move move) {
if (solver.isSolving()) {
logger.error("Not doing user move ({}) because the solver is solving.", move);
return;
}
if (!move.isMoveDoable(guiScoreDirector)) {
logger.warn("Not doing user move ({}) because it is not doable.", move);
return;
}
logger.info("Doing user move ({}).", move);
move.doMove(guiScoreDirector);
}
}
这是我的maven依赖:
最佳答案
同样的错误。我去了 Maven Repository,寻找最新的非测试版。只需更改版本即可。工作 pom:
<properties>
<slf4j.version>1.7.26</slf4j.version>
<logback.version>1.2.3</logback.version>
</properties>
<dependencies>
<!-- LOGGING -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
</dependencies>
关于java - 带logback的SLF4J还是提示failed to load class "org.slf4j.impl.StaticLoggerBinder",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28754323/
我正在 div 中加载一个 php 页面,该页面采用发布的变量来显示正确的内容。它的工作原理是这样的: $(".mainArea").load("page.php", {'folder': 'a'})
我是 AWS 新手。我开始学习 ALB 和 NLB。我知道 ALB 在第 7 层协议(protocol)中工作,而 NLB 在第 4 层协议(protocol)中工作。 谁能解释一下ALB和NLB的实
这是来自 this Article . filter(loaded => !loaded) 有什么作用?我没有在任何地方看到该变量的定义。 我明白这个方法的目的是什么,只是不是那一行。 canActi
我应该在 Constructor 还是 FormLoad() 中加载子表单? 我有一些代码调用在控件中嵌入表单的自定义类。我最初是在 Constructor 之外声明我的子窗体,然后在 FormLoa
目录 1、图解 2、json.loads()用法 3、json.load()用法 4、此外还有一种json.dumps 语法
我正在使用 PhoneGap 为 iPad 编写应用程序,我想在不触发 Safari 或使用 ChildBrowser 等内部 Web 浏览器的情况下加载外部 URL。 我正在使用 PhoneGap
人们经常在他们的(与优化和性能相关的)问题和答案中谈论“重载”。 我试图在典型服务器上的常规 Web 应用程序的上下文中量化这一点(以 SO 及其相当小的基础设施为例),假设它们立即返回(以简化和提高
有人可以写这段代码吗: this.Loaded += (s, e) => this.loaded = true; 分成几行代码以便我可以追溯其含义? 在我的代码示例中没有 s 或 e 吗? 最佳答案
我正在使用 jQuery 的 .load()方法和Loading Page Fragments 。以下是我当前的代码: $("#submit").click(function() { $("#
我想实现的是,当单击图像时,在该图像所在的 div 中,加载了一个包含来自另一个 .html 的其他内容的 div,但我无法完成。 如果我这样做,下面的代码将完美运行: $('#windows_lin
我使用 qt 开发了一个 c++ 库。在本文中,我使用 QSqlDatabase 从 SQLite 数据库中查询信息。注意:我的库在 qt 桌面应用程序中运行良好(我在 Linux 上开发)。 现在我
演示:http://jsfiddle.net/FyrRm/1/ 当我们向下滚动时,您会注意到...在滚动到文章标题到 之后我正在展示一个共享小部件。我正在使用 $(window).on("load"
我在 html(PC) 中使用的图像正确加载,我使用了 img 标签。我已将此文件连同图像一起保存并发送到我的手机,但它不会加载到手机上。我对图像大小或任何东西没有任何问题。我认为它与图像位置有关。
我将 .load() 广泛用于 AJAX 内容。很棒,但如果它做得更多一点,我会喜欢它: 如果为了响应用户操作,我多次调用同一个 div 上的 .load(),我可能会在 div 中得到错误的数据。当
我知道很多方法需要调用它的父类(super class)方法,有些方法不需要, 我正在寻找关于方法调配的东西。它在加载方法中初始化,并且在教程中没有[super load]。 我想知道是不是错了,还是
几个月来,我一直在使用pyGame 2.0.1。今天,我升级到最新版本(2.1.2)后,在尝试加载音频文件时开始出现以下错误:。到目前为止我尝试过的东西:。我使用的是Windows 10、Python
我有一个完整的 angular 应用程序,它使用预先加载。 我想将其转换为延迟加载,但是因为我对所有路线都有保护,而且所有路线都是到一条 protected 主路线的子路线,我不知道是否可以做到这一点
我有一个 React 应用程序,它在 useEffect 中调用我的 API,返回一个用作 imy 图像 src 的 URL 列表。 我正在使用 react-loader-spinner 在加载图像时
我正在使用 Slick.js 逐步加载我的图像我注意到有些图像要么部分加载,要么根本没有加载。 例如,在this site上,有两个画廊:建筑和设计(在导航中)。当用户单击任一图像时,他们会看到该图库
我在我的一个项目中收到此警告。这在调用我的后端 api 时会导致问题,因为它调用了 api 两次。我已经尝试过之前在论坛上发布的关于相同查询的解决方案,但我无法解决这个问题。如果有人能帮助我解决这个问
我是一名优秀的程序员,十分优秀!