I have a maven project that uses slf4j with logback as a logger. I could see that both artifacts are in my maven dependency tree element. But whenever I tried to run my project, I keep suggesting:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: default for inactivity (NOP) SLF4J: For more information see http://www.slf4j.org/codes.html#StaticLoggerBinder .
I check the link and it was said:
Putting one (and only one) of slf4j-nop.jar, slf4j-simple.jar, slf4j-log4j12.jar, slf4j-jdk14.jar or logback-classic.jar in the class path should solve the problem.
I am adding logback-classic to my project (I am using 1.0.9), but I keep asking that this message and my log are not working.
Can someone help me solve this problem? Thanks.
UPDATE:
<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> <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> <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>
and here is my logback.xml:
<?xml version="1.0" encoding="UTF-8"?> <configuration> <appender name="consoleAppender" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <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" /> </root> </configuration>
How I use it in my program:
public class SolutionBusiness { protected final transient Logger logger = LoggerFactory.getLogger(getClass());
Here are my maven dependencies:

source share