RapidPM Logger Adapter

Logger Adapter with Core Java

License

License

GroupId

GroupId

org.rapidpm
ArtifactId

ArtifactId

rapidpm-logger-adapter
Last Version

Last Version

01.00.10-RPM
Release Date

Release Date

Type

Type

jar
Description

Description

RapidPM Logger Adapter
Logger Adapter with Core Java
Project URL

Project URL

https://github.com/svenruppert/logger-adapter
Project Organization

Project Organization

RapidPM
Source Code Management

Source Code Management

https://github.com/svenruppert/logger-adapter

Download rapidpm-logger-adapter

How to add to project

<!-- https://jarcasting.com/artifacts/org.rapidpm/rapidpm-logger-adapter/ -->
<dependency>
    <groupId>org.rapidpm</groupId>
    <artifactId>rapidpm-logger-adapter</artifactId>
    <version>01.00.10-RPM</version>
</dependency>
// https://jarcasting.com/artifacts/org.rapidpm/rapidpm-logger-adapter/
implementation 'org.rapidpm:rapidpm-logger-adapter:01.00.10-RPM'
// https://jarcasting.com/artifacts/org.rapidpm/rapidpm-logger-adapter/
implementation ("org.rapidpm:rapidpm-logger-adapter:01.00.10-RPM")
'org.rapidpm:rapidpm-logger-adapter:jar:01.00.10-RPM'
<dependency org="org.rapidpm" name="rapidpm-logger-adapter" rev="01.00.10-RPM">
  <artifact name="rapidpm-logger-adapter" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.rapidpm', module='rapidpm-logger-adapter', version='01.00.10-RPM')
)
libraryDependencies += "org.rapidpm" % "rapidpm-logger-adapter" % "01.00.10-RPM"
[org.rapidpm/rapidpm-logger-adapter "01.00.10-RPM"]

Dependencies

compile (2)

Group / Artifact Type Version
org.jetbrains.kotlin : kotlin-stdlib-jdk8 jar 1.3.72
com.google.code.findbugs : jsr305 jar 3.0.2

provided (3)

Group / Artifact Type Version
org.apache.logging.log4j : log4j-core Optional jar 2.13.3
org.apache.logging.log4j : log4j-api Optional jar 2.13.3
org.slf4j : slf4j-api Optional jar 1.7.30

test (13)

Group / Artifact Type Version
org.jetbrains.kotlin : kotlin-test-junit jar 1.3.72
org.junit.jupiter : junit-jupiter-api jar 5.7.0-M1
org.junit.jupiter : junit-jupiter-params jar 5.7.0-M1
org.junit.platform : junit-platform-launcher jar 1.7.0-M1
org.junit.jupiter : junit-jupiter-engine jar 5.7.0-M1
org.junit.platform : junit-platform-testkit jar 1.7.0-M1
com.google.truth : truth jar 1.0.1
org.openjdk.jmh : jmh-core jar 1.23
org.openjdk.jmh : jmh-core-benchmarks jar 1.23
org.openjdk.jmh : jmh-generator-annprocess jar 1.23
org.openjdk.jmh : jmh-generator-reflection jar 1.23
com.github.javafaker : javafaker jar 1.0.2
org.slf4j : slf4j-simple jar 1.7.30

Project Modules

There are no modules declared in this project.

Logger Adapter

A Core Java Logger Adapter that will give you the possibility to write Logger independent code.

Status

Maven Central

Sonarcloud Status Sonarcloud Status

JDK8 or JDK9 and above

I compiled this with the Open JDK8. Previous versions at maven central are build ith JDK10. I went away from the JDK10, because most projects I know, are using JDK8 in production right know. But, if you want to use this with JDK9/10/11/... you can use it.. it is working perfect! Only if you start using the JMS, it could be helpful to add a module-info.java Add the following lines, switch inside the pom.xml to the JDK version you prefer, start a mvn clean install and be happy ;-)

module rapidpm.dependencies.core.logger {
  requires log4j;
  requires transitive java.logging;
  requires slf4j.api;
  requires org.apache.logging.log4j;
  exports org.rapidpm.dependencies.core.logger;
}

Supported Versions and vendors

Vendors

  • OpenJDK
  • Oracle
  • Oracle - GraalVM
  • Amazon
  • IBM
  • Adopt-OpenJ9
  • Zulu
  • Liberica

JDK Versions

  • JDK 6
  • JDK 7
  • JDK 8
  • JDK 9
  • JDK 10
  • JDK 11
  • JDK 12
  • JDK 13
  • JDK 14

Why do we need a Core Java Logger Adapter?

In every project, there is the decision of what logger framework should be used. The bad thing here is, whatever you are choosing, it will be the wrong one. Other projects or frameworks are using different logger frameworks. So I decided to create a simple, robust solution that will give me the freedom to stop worrying about it. At runtime, this Adapter will check what logging framework is available in the classpath and will transparently use this.

How to use?

To use this you have two possibilities. However, the first step is to add the dependency to your pom.xml. Second step is, chooseing the way you want to define a Logger.

Way One:

Define a class attribute.

LoggerService logger = Logger.getLogger(getClass());

Way Two:

You can implement an interface, that will give you a method to get the logger. The interface provides a default - implementation, so there is nothing additional to do for you. This solution is perfect for web apps as well because you don´t have to worry about Serializable.

MyClass implements HasLogger {}

Versions

Version
01.00.10-RPM
01.00.06-RPM
01.00.04-RPM
01.00.03-RPM
01.00.02-RPM
01.00.01-RPM
01.00.00-RPM