Skip to content

mnlipp/de.mnl.osgi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

de.mnl.osgi

Build Status

A collection of miscellaneous OSGi bundles and components.

OSGi Core Utils

Bundle Maven
de.mnl.osgi.coreutils Maven Central

A small bundle with utilities/helpers. Currently, it provides a new kind of service tracker that works around the problem outlined here.

OSGi Logging Bridges/Facades

Bundle Maven
de.mnl.osgi.lf4osgi Maven Central
de.mnl.osgi.slf4j2osgi Maven Central
de.mnl.osgi.log4j2osgi Maven Central
de.mnl.osgi.jul2osgi Maven Central
de.mnl.osgi.jul2osgi.lib Maven Central
de.mnl.osgi.osgi2jul Maven Central

Logging in OSGi seems to be a notorious problem. Libraries—even if they have OSGi bundle headers—avoid dependencies on OSGi and therefore use one of the "standard" logging libraries such as java.util.logging, log4j, SLF4J or commons logging.

When writing dedicated OSGi components, you should use the Log Service, but even with declarative services its usage is a bit cumbersome compared to the ease of use that you get with the logging libraries.

I've searched, but all attempts to solve the problem seemed rather complex to me. So I have written my own set of really simple to use bridging/facade bundles. Contrary to some other "unification attempts", these bridges/facades put OSGi logging in the center. All log events from the "standard" libraries mentioned above are forwarded to the OSGi logging service, and all logging results can be obtained from the OSGi logging service (e.g. displayed in the Apache Felix Web Console).

  • LF for OSGi: A logging facade for OSGi logging. Makes using OSGi logging as simple as using one of the "standard" libraries.

  • SLF4J for OSGi: A SLF4J logging facade for OSGi logging. Built on LF4OSGi's core classes.

  • Log4j to OSGi: Not sure if this is a facade or a bridge. Anyway, forwards calls to the log4j 2 API to OSGi logging. Built on LF4OSGi's core classes.

  • JUL to OSGi: forwards all logging events from java.util.logging to the OSGi log service.

  • OSGi to JUL: invokes JUL compliant handlers for the messages logged with the OSGi log service.

Indexed Maven Repository Plugin for bnd

The Indexed Maven Repository Plugin maintains an index of a subset of one or more maven repositories and provides the information as an OSGi repository for building and resolving.

The plugin has a documentation page of its own.

Other Sub-Projects

See the READMEs in the subdirectories for details.

Usage

The easiest way to include the bundles in your bnd workspace build is to add a BndPomRepository:

-plugin.xx.MnlOSGi: \
    aQute.bnd.repository.maven.pom.provider.BndPomRepository; \
        name=MnlOSGi; \
        readOnly=true; \
        releaseUrls=https://repo.maven.apache.org/maven2/; \
        query='q=g:%22de.mnl.osgi%22'