karaf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt Sicker (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (KARAF-3173) Using SLF4J does not log anything
Date Tue, 02 Sep 2014 01:25:20 GMT

     [ https://issues.apache.org/jira/browse/KARAF-3173?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Matt Sicker resolved KARAF-3173.
--------------------------------
    Resolution: Not a Problem

I figured out the problem. I had to make {{slf4j-api}} a provided dependency instead of a
compile dependency. That way everything works fine without introducing a separate bundle dependency.

> Using SLF4J does not log anything
> ---------------------------------
>
>                 Key: KARAF-3173
>                 URL: https://issues.apache.org/jira/browse/KARAF-3173
>             Project: Karaf
>          Issue Type: Bug
>          Components: karaf-core
>    Affects Versions: 3.0.1
>            Reporter: Matt Sicker
>              Labels: logging, slf4j
>
> Here's the relevant parts of my {{org.ops4j.pax.logging.cfg}} file:
> {code}
> # 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
> {code}
> Then, inside a bundle class, I have a private static final Logger from SLF4J. Doing the
following won't log anything anywhere:
> {code}
> LOGGER.debug("Hello, world!");
> LOGGER.error("Not even this!");
> {code}
> Viewing the headers of my bundle show the following in the Import-Package attribute:
> {code}
> org.slf4j;version="[1.7,2)"
> {code}
> For the Pax logging API bundle, it has the following in its Export-Package attribute:
> {code}
> org.slf4j;uses:="org.slf4j.helpers,org.slf4j.spi";provider=paxlogging;version=1.7.1
> {code}
> 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).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message