[logback-user] Project Can't Find logback.xml file

Tony Trinh tony19 at gmail.com
Sat Jan 21 03:27:36 CET 2012

See below...

On Fri, Jan 20, 2012 at 8:06 PM, Roger Spears <rspears at northweststate.edu>wrote:

> I also tried adding the class to the encoder. That didn't work either.
> Something else that's weird.  I imported Tony's project to my Netbeans and
> it stated it had reference issues.  It could not find
> logback-core-1.0.0.jar, logback-classic-1.0.0.jar and sl4j-api-1.6.4.jar.
> I know I can resolve this, I'll just point them towards my versions of
> those jar's.  BUT, for giggles, I ran the project with the unresolved
> reference issues and it displayed the same thing on the console:
> 19:57:35.609 [main] INFO  helloworld.HelloWorld - hello world!
I just imported that project into another machine, updated the JAR
references (as they're not in the same location on the other machine), and
ran it. I see this:

2012-01-20 21:10:50,277
 FOOBAR [main] INFO helloworld.HelloWorld -
 hello world!BUILD SUCCESSFUL (total time: 0 seconds)

> I'm not sure if that's a clue to anything or if that's the expected
> behavior since I have those files in my classpath.
Try my exact steps to create that project:

1. Create a new Java project in Netbeans (or Eclipse...same steps here

2. Create a class named "HelloWorld", and copy this code into it:

package helloworld;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class HelloWorld {
private static final Logger LOG = LoggerFactory.getLogger(HelloWorld.class);
 public static void main(String[] args) {
 LOG.info("hello world!");

3. Create a file named logback.xml in the src directory (do not put it
under src/helloworld or any other subdirectory). Copy the following into
the file:

  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
      <pattern>%date %n FOOBAR [%thread] %level %logger{35} - %n
  <root level="DEBUG">
    <appender-ref ref="STDOUT" />

*You can actually put logback.xml into any directory specified by the
run.classpath property in ${project.dir}/nbproject/project.properties. We
used src here only because it's quick and easy.*

4. Build and run the project.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20120120/8c35c9d6/attachment-0001.html>

More information about the Logback-user mailing list