Uploaded image for project: 'Karaf'
  1. Karaf
  2. KARAF-3173

Using SLF4J does not log anything

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • 3.0.1
    • None
    • karaf

    Description

      Here's the relevant parts of my org.ops4j.pax.logging.cfg file:

      # File appender
      log4j.appender.out=org.apache.log4j.RollingFileAppender
      log4j.appender.out.layout=org.apache.log4j.PatternLayout
      log4j.appender.out.layout.ConversionPattern=%d{ABSOLUTE} | %-5.5p | %-16.16t | %-32.32c{1} | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n
      log4j.appender.out.file=${karaf.data}/log/karaf.log
      log4j.appender.out.append=true
      log4j.appender.out.maxFileSize=1MB
      log4j.appender.out.maxBackupIndex=10
      
      log4j.logger.com.peapod=DEBUG, out
      

      Then, inside a bundle class, I have a private static final Logger from SLF4J. Doing the following won't log anything anywhere:

      LOGGER.debug("Hello, world!");
      LOGGER.error("Not even this!");
      

      Viewing the headers of my bundle show the following in the Import-Package attribute:

      org.slf4j;version="[1.7,2)"
      

      For the Pax logging API bundle, it has the following in its Export-Package attribute:

      org.slf4j;uses:="org.slf4j.helpers,org.slf4j.spi";provider=paxlogging;version=1.7.1
      

      The only way I've been able to log anything whatsoever has been to inject the OSGi LogService which shouldn't be required. I'm using OPS4J Pax Logging version 1.7.2 if that helps (the 1.7.1 is for SLF4J apparently).

      Attachments

        Activity

          People

            Unassigned Unassigned
            mattsicker Matt Sicker
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: