views:

79

answers:

1

I have added slf4j 1.6.1, logback-core-0.9.24.jar, and logback-classic-0.9.24.jar to my target platform and added them as a dependency in the MANIFEST file in a plug-in project.

In the Activator I do:

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class Activator implements BundleActivator {
  private static final Logger logger = LoggerFactory.getLogger(Activator.class
      .getName());

  private static Activator defaultInstance;

  public Activator() {
    Activator.defaultInstance = this;
  }

  /*
   * (non-Javadoc)
   * 
   * @see
   * org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext )
   */
  public void start(BundleContext context) throws Exception {
    System.out.println(logger.isInfoEnabled());
    System.out.println(logger.isDebugEnabled());
    System.out.println(logger.isWarnEnabled());
    System.out.println(logger.isErrorEnabled());
    logger.info("llllladasdad");
  }
  }
}

but it just prints false for all cases and nothing for the info call. How do I enable logback in an eclipse PDE project?

A: 

You can try to force the logback configuration, reseting the default config to load your own XML config file. The code to do that is described in logback documentation.

Benoit Courtine