EclipseLink is a recognized Java persistence framework and the reference implementation for JPA 2.0.
SLF4J is a recognized Java logging API and a framework for bridging different Java logging systems in one application if necessary.
EclipseLink makes use of its own logging platform and has a built-in bridge to java.util.logging system. It is possible to arrange logging from EclipseLink via SLF4J using jul-to-slf4j bridge, but this solution is known to be CPU expensive (see the bridge description).
This project allows direct logging from EclipseLink via SLF4J with necessary
precautions taken regarding performance and is implemented after EclipseLink
Other implementations for the same task are also known:
- EclipseLinkSessionLogger with SLF4J - a short implementation at blogger.com
- PE-INTERNATIONAL / org.eclipse.persistence.logging.slf4j - a project at GitHub
Both pom.xml for Maven and build.xml for Ant are available. Ant buildfile automatically labels every build with current date. Maven builds are labeled with project version from the .pom file, but a warning is issued if this version does not match current date. Artifact/build versions are currently formatted like "YYYYMMDD" rather than "v1.0", as no distinct versioning policy has evolved so far.
Usage – HOW-TO
- download or build the latest 'usn-eclipselink-slf4j-YYYYMMDD.jar' file and add it to your application class path;
- register this logger with your
persistence.xmlas per EclipseLink logger documentation and EclipseLink wiki on JPA logging:
<property name="eclipselink.logging.logger" value="usn.eclipse.persistence.logging.SLF4JLog" />
- arrange your logging via SLF4J as per SLF4J user manual;
- enjoy :)
The project is issued and distributed under the following licenses as per the original license model by EclipseLink:
The following distribution types are available:
- plain JAR:
- Maven style javadoc and sources JARs:
- full distribution that contains everything:
The latest release can be found here.
- make the Maven artifact for the project available from some public repository.