I've found out the problem. Pax-logging-api bundle also must be started. It is interesting why some logging frameworks work without starting bundle some don't.
I think it is better to give some notification this case because user can think that he gets all logging messages but in reality only some of them. Best regards, Pavel воскресенье, 2 апреля 2017 г., 10:06:19 UTC+3 пользователь Pavel написал: > > Hi Niclas > > I've checked these are bundles that are installed > > # Id State Location > 1 0 32 System Bundle > 2 1 32 file:./../jars/org.osgi.enterprise-5.0.0.jar > 3 2 32 file:./../jars/org.apache.felix.scr-2.0.2.jar > 4 3 32 file:./../jars/org.apache.felix.configadmin-1.8.8.jar > 5 4 4 file:./../jars/pax-logging-api-1.9.1.jar > 6 5 32 file:./../jars/pax-logging-service-1.9.1.jar > 7 6 32 file:./../jars/guava-18.0.jar > 8 7 32 file:./../jars/javax.persistence-2.1.1.jar > 9 8 2 > file:./../jars/org.eclipse.gemini.dbaccess.util_1.1.0.201206011559.jar > 10 9 4 file:./../jars/my-bundle-0.1.0.jar > > From them only pax-logging-api-1.9.1.jar contains org.slf4j.* packages. > > Best regards, Pavel > > воскресенье, 2 апреля 2017 г., 7:15:11 UTC+3 пользователь Niclas Hedhman > написал: >> >> Hi, >> Could it be that you have SLF4J API installed as a bundle? Pax Logging >> needs to own the API's to be able to do the redirection it does. >> >> Niclas >> >> On Sun, Apr 2, 2017 at 2:37 AM, Pavel <[email protected]> wrote: >> >>> Hi all >>> >>> I have the following situation. I have bundles: >>> pax-logging-api-1.9.1.jar, pax-logging-service-1.9.1.jar and my-bundle. >>> >>> In my-bundle Activator I have the following code >>> >>> import org.slf4j.LoggerFactory;//NOTE >>> import java.util.logging.Level;//NOTE >>> import java.util.logging.Logger;//NOTE >>> >>> public class Activator implements BundleActivator { >>> >>> private static final org.slf4j.Logger slf4j = >>> LoggerFactory.getLogger(Activator.class); >>> >>> private Server server; >>> >>> public void start(BundleContext context) throws Exception { >>> slf4j.error("### MyError 1"); >>> Logger javaLog = Logger.getLogger(Activator.class.getName()); >>> javaLog.log(Level.SEVERE, "### MyError 2"); >>> } >>> >>> public void stop(BundleContext context) throws Exception { >>> } >>> >>> } >>> >>> Pax loggin-service configuration I do via ManagedService. >>> >>> This is the output I see on console: >>> >>> [my-bundle.Activator] : ### MyError 1 >>> 2017-04-01 21:24:54,306 | ERROR | tion(2)-X.X.X.X | 47 -my-bundle | >>> my-bundle.Activator | ### MyError 2 >>> >>> Pay attention of the message format. My Error 1 is printed via >>> pax-logging-api, My Error 2 is printed via pax-logging-service. >>> >>> And in all my log files I don't see any messages from slf4j api. How to >>> explain it? Maybe I do something wrong? >>> >>> Best regards, Pavel >>> >>> -- >>> -- >>> ------------------ >>> OPS4J - http://www.ops4j.org - [email protected] >>> >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "OPS4J" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> >> >> -- >> Niclas Hedhman, Software Developer >> http://polygene.apache.org - New Energy for Java >> > -- -- ------------------ OPS4J - http://www.ops4j.org - [email protected] --- You received this message because you are subscribed to the Google Groups "OPS4J" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
