Pax Logging

Introduction

Pax Logging is an implementation of OSGi Log Service API. Pax Logging 1.x releases implement OSGi org.osgi.service.log package in version 1.3 while Pax Logging 2.x releases will implement OSGi org.osgi.service.log package in version 1.4.

Not only pure OSGi logging API is implemented. Pax Logging hides the OSGi specific interfaces and mechanisms under popular Logging APIs. These include:

Developers writing their OSGi bundles have wide choice of Logging APIs to use. All the above are supported and relevant packages are exported from single pax-logging-api bundle.

At backend Pax Logging supports three actual Logging frameworks:

Each of the above is included in respective Pax Logging bundles: pax-logging-service, pax-logging-logback and pax-logging-log4j2. These bundles provide OSGi support for the above frameworks and allow their configuration through OSGi Configuration Admin API.

What's most important is that the choice of Logging API used by any bundle doesn't force developer to use particular Logging backend. For example, Log4j2 API can be used to call logging methods while the actual framework used to write the log statements may be Log4J1.

Latest News

Pax Logging 1.11.6 and 2.0.3 were released with Log4j2 upgrade to version 2.13.2 due to CVE-2020-9488: https://issues.apache.org/jira/browse/LOG4J2-2819

These releases do not contain any other changes.

Pax Logging 1.10.6 has been released where thanks to Monica Ron all discovered memory issues where solved (as proved by integration tests backported from 1.11.x) - thanks again!

Checkout the release notes Pax Logging 1.10.6 for more details.

 

Pax Logging 2.0.2 has been released with one improvement. It can now be used without Configuration Admin while preserving all configuration methods.

Configuration page shows how to use Pax Logging without Configuration Admin and how to use org.ops4j.pax.logging.property.file system or bundle context property to specify actual Configuration file (for any of the backends).

Here’s a list of fixed JIRA issues:

 

Pax Logging team is proud to announce Pax Logging 2 release. Due to unforeseen shading problem, initial 2.0.0 release had JDK11 failure, so the Pax Logging 2 has version 2.0.1…

The most important feature of this release is support for OSGi R7 logging package (org.osgi.service.log version 1.4). Pax Logging itself was always more about using standard, non-OSGI specific facades to logging mechanisms, but now, standard org.osgi.service.log.Logger interface can be used as well.

This is new R7 way to use loggers:

org.osgi.framework.BundleContext context = ...; ServiceReference<org.osgi.service.log.LoggerFactory> sr = context.getServiceReference(org.osgi.service.log.LoggerFactory.class); org.osgi.service.log.LoggerFactory factory = context.getService(sr); org.osgi.service.log.Logger log = factory.getLogger("my.logger"); log.info("INFO through R7 org.osgi.service.log.Logger"); log.audit("AUDIT through R7 org.osgi.service.log.Logger");

Just like Pax Logging 1.11.x, 2.x line comes with huge refactoring and unification of internal mechanism + more than 100 integration tests that were not present before 1.11.x.

OSGi R7 specification introduces two additional packages:

  • org.osgi.service.log.admin (

    )

  • org.osgi.service.log.stream(

    )

These packages are not yet implemented by Pax Logging 2.0.1. Pax Logging exposes (that was one of initial design goals) configuration of underlying logging framework through Configuration Admin and org.osgi.service.log.admin is not straightforward to implement assuming this requirement. PAXLOGGING Jira issues for the above package implementations are the only issues left to be done (as of 2020-01-13).

Here’s full list of Jira issues resolved:

Pax Logging 1.10.5 has been released. It contains two bug fixes found by Monica Ron - thanks!

Checkout the release notes Pax Logging 1.10.5 for more details.