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
- Host: GitHub
- URL: https://github.com/marschall/slf4j-equinox
- Owner: marschall
- Created: 2012-04-15T11:28:14.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2024-07-21T19:33:11.000Z (10 months ago)
- Last Synced: 2025-01-21T08:03:19.133Z (4 months ago)
- Topics: equinox, java, slf4j
- Language: Java
- Homepage:
- Size: 65.4 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
SLF4J Equinox [](https://maven-badges.herokuapp.com/maven-central/com.github.marschall/com.github.marschall.slf4j-equinox) [](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 ignoredThis 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. AConcurrentHashMap
uses more memory thanHashMap
but allows for concurrent lookups even thoughExtendedLogServiceImpl#getLogger
issynchronized
. The values are not weak for now asLog4jLoggerFactory
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 yoursettings.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
```