I’ve built an OSGi application that relies on external libraries such as Quartz.
I have created separate bundle for all of these libraries but the problem is they have their own logging configuration.
So when I run my application quartz logs to the console
[DefaultQuartzScheduler_QuartzSchedulerThread] DEBUG o.quartz.core.QuartzSchedulerThread - batch acquisition of 0 triggers
I’m a little lost in how to correctly limit or redirect the logging. I have a log4j.xml file in the Quartz bundle which attempts to set the logging level to error but it has no effect
<logger name="org.quartz">
<level value="error" />
<appender-ref ref="console" />
</logger>
I’ve been searching for an OSGi logging strategy but am ending up more confused.
Take a look at Pax-Logging – it will handle most of the many logging frameworks. Just make sure you don’t deploy the actual log4j jar, the Pax-Logging api and implementation bundles will take care of everything for you.
You can set a default logging level, but for more detailed configuration you’ll need a ConfigAdmin service as well. See http://team.ops4j.org/wiki/display/paxlogging/Configuration