0

I'm very new to OSGi, and one thing I am currently looking into is logging in OSGi. I'm currently running JBoss FUSE, and what I have gathered from my research so far is that I am able to use the OPS4J Pax Logging library that's built into FUSE.

Typically with log4j, you would log a message like this:

logger.info("Informative Message");

However, with the PaxLogger class (v1.8.4), there is no info method, but rather, an inform method like this:

inform( String message, Throwable t );

What I am stumped by, is the second parameter required by the inform method. I guess I could pass in a null value, however, I think I should know what that second parameter is supposed to do, and that is something I cannot seem to find online. Most Pax Logging material online seems to be outdated.

Any help?

Claus Ibsen
  • 56,060
  • 7
  • 50
  • 65
Earthling
  • 283
  • 5
  • 17

1 Answers1

0

Do not use the pax logger. It only works in the background. In your application you simply use your logging API. Pax logging support slf4j, log4j and commons logging. Most people use slf4j at the moment.

Simply create the logger in your class and log. Do not try to configure the logging backend in your bundle.

Christian Schneider
  • 19,420
  • 2
  • 39
  • 64
  • I see! I have seen a couple of articles [here](https://ops4j1.jira.com/wiki/display/paxlogging/How+to+use+Pax+Logging+in+my+bundles) and [here](http://ekkes-corner.blogspot.com.es/2008/09/logging-in-osgi-enterprise-applications.html) that talk about using Pax logging, which is what gave me the idea to run with them. – Earthling Oct 23 '15 at 11:19
  • Btw. you do not need to add manual Import-Package statements. Just let the maven bundle plugin build your project and it does the right thing. – Christian Schneider Oct 23 '15 at 11:23