Skip to content

Logging

Fathardie edited this page May 12, 2017 · 4 revisions

We integrated pax-logging to allow for a scala of logging API's and to aggregate all logging before pushing it out to a destination. To allow logging for your bundle:

  • Include the pax-logging-service and pax-logging-api bundles in your felix deployment
  • Add pax-logging-api as a dependency to your pom.xml (already included in dependencymanagement in top parent pom):
<dependency>
    <groupId>org.ops4j.pax.logging</groupId>
    <artifactId>pax-logging-api</artifactId>
</dependency>
  • Now use import org.apache.log4j.Logger; and Logger.getLogger("<some logger grouping name>").{debug,fatal,info,warning,error,trace}("<some message>") to log your messages.

  • Default loglevel: DEBUG If you want to change this default, you can add the following system property in your felix config:

org.ops4j.pax.logging.DefaultServiceLog.level=<LEVEL>

Valid levels are: NONE,OFF,DEBUG,INFO,ERROR,WARN. As Pax uses log4j to output any log messages, please go to here to see the order of log messages.

  • Please use version >= 1.10.0. 1.9.1 cannot use the default OFF loglevel.
Clone this wiki locally