Skip to content

marschall/slf4j-equinox

Repository files navigation

SLF4J Equinox Maven Central Javadocs

This is an implementation of SLF4J using the Equinox ExtendedLogService.

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 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

Building

If you want to build this project then you need Maven 3 and add the following section to your settings.xml

<profile>
  <id>eclipse</id>
  <activation>
    <activeByDefault>false</activeByDefault>
  </activation>
  <repositories>
    <repository>
      <id>eclipse-28</id>
      <layout>p2</layout>
      <url>https://download.eclipse.org/eclipse/updates/4.28/</url>
    </repository>
    <repository>
      <id>eclipse-28-local</id>
      <url>file:///home/user/bin/eclipse/eclipse-4.28</url>
    </repository>
  </repositories>
</profile>

Publishing

To publish the artifact to a p2 site (or build a new one) you can use the Features And Bundles Publisher Application

java -jar <targetProductFolder>/plugins/org.eclipse.equinox.launcher_*.jar \
-application org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher \
-metadataRepository file:/<some location>/repository \
-artifactRepository file:/<some location>/repository \
-source /<location with a plugins and features directory> \
-configs gtk.linux.x86 \
-compress \
-publishArtifacts

Installing

You can install form the site you built above using the p2 director application

java -jar <targetProductFolder>/plugins/org.eclipse.equinox.launcher_*.jar \
-application org.eclipse.equinox.p2.director \
-repository file:/<some location>/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 <targetProductFolder>

About

slf4j implementation using the Equinox ExtendedLogService

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages