Search code examples
loggingosgijbossfuseops4j

Pax Logging in JBoss FUSE


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?


Solution

  • 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.