An open API service indexing awesome lists of open source software.

https://github.com/marschall/slf4j-equinox

slf4j implementation using the Equinox ExtendedLogService
https://github.com/marschall/slf4j-equinox

equinox java slf4j

Last synced: 2 months ago
JSON representation

slf4j implementation using the Equinox ExtendedLogService

Awesome Lists containing this project

README

        

SLF4J Equinox [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.marschall/com.github.marschall.slf4j-equinox/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.marschall/com.github.marschall.slf4j-equinox) [![Javadocs](https://www.javadoc.io/badge/com.github.marschall/com.github.marschall.slf4j-equinox.svg)](https://www.javadoc.io/doc/com.github.marschall/com.github.marschall.slf4j-equinox)
=============

This is an implementation of [SLF4J](https://www.slf4j.org) using the [Equinox](https://www.eclipse.org/equinox/) [ExtendedLogService](https://bugs.eclipse.org/bugs/show_bug.cgi?id=260672).

In plain words it makes all code that uses SLF4J log to the Equinox .metadata/.log log file. It does this by redirecting all the log messages to the Equinox `ExtendedLogService`. This is mostly interesting for code that runs inside Eclipse RCP applications. This does _not_ make Equinox use SLF4J.

Versions 2.x are for SLF4J 2 and rely on `ServiceLoader`.

Versions 1.x are for SLF4J 1 and are a fragment.

Caveats
-------

* the Equinox context object is always `null`
* the SLF4J markers are ignored

This shouldn't be installed along side `ch.qos.logback.slf4j`, `org.slf4j.impl.log4j12` or , `slf4j.nop`.

There are two SLF4J bundles the Maven artifact uses `slf4j.api` the [Orbit](https://www.eclipse.org/orbit/) uses `org.slf4j.api`.

Implementation Notes
--------------------

We keep a ConcurrentHashMap of strings to logger adapters. A ConcurrentHashMap uses more memory than HashMap but allows for concurrent lookups even though ExtendedLogServiceImpl#getLogger is synchronized. The values are not weak for now as Log4jLoggerFactory doesn't use weak values as well.

We rely on [OSGi Service Loader Mediator](https://eclipse.dev/eclipse/news/4.28/platform.php#slf4j.api-version-2)

Building
--------
If you want to build this project then you need [Maven 3](https://maven.apache.org/) and add the following section to your settings.xml

```xml

eclipse

false



eclipse-32
p2
https://download.eclipse.org/eclipse/updates/4.32/


eclipse-28-local
file:///home/user/bin/eclipse/eclipse-4.32

```

Publishing
----------

To publish the artifact to a p2 site (or build a new one) you can use the [Features And Bundles Publisher Application](https://wiki.eclipse.org/Equinox/p2/Publisher#Features_And_Bundles_Publisher_Application)

```sh
java -jar /plugins/org.eclipse.equinox.launcher_*.jar \
-application org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher \
-metadataRepository file://repository \
-artifactRepository file://repository \
-source / \
-configs gtk.linux.x86 \
-compress \
-publishArtifacts
```

Installing
----------

You can install form the site you built above using the [p2 director application](https://help.eclipse.org/latest/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/p2_director.html)

```sh
java -jar /plugins/org.eclipse.equinox.launcher_*.jar \
-application org.eclipse.equinox.p2.director \
-repository file://repository \
-installIU com.github.marschall.slf4j-equinox \
-uninstallIU org.slf4j.log4j,ch.qos.logback.slf4j,org.eclipse.jetty.slf4jlogback.feature.group,org.eclipse.jetty.sdk.feature.group \
-tag slf4j-equinox \
-destination
```