Skip to content

Commit

Permalink
elf4j version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
q3769 committed Mar 20, 2023
1 parent 46ff215 commit 8b20e97
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 60 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Publish to OSSRH for Maven Central
- name: Publish to OSSRH
run: mvn --batch-mode deploy -Prelease
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml

# Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
- name: Update dependency graph
uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6
# Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
- name: Update dependency graph
uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ buildNumber.properties
.mvn/timing.properties
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
.mvn/wrapper/maven-wrapper.jar
/.idea/
27 changes: 12 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,28 @@
[![Maven Central](https://img.shields.io/maven-central/v/io.github.elf4j/elf4j-logback.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22io.github.elf4j%22%20AND%20a:%22elf4j-logback%22)

# elf4j-logback

The [LOGBACK](https://logback.qos.ch/) service provider binding for the Easy Logging Facade for
Java ([ELF4J](https://github.com/elf4j/)) SPI
An adapter to use [LOGBACK](https://logback.qos.ch/) as service provider and logging engine
for the [ELF4J](https://github.com/elf4j/elf4j) (Easy Logging Facade for Java) API

## User story
## User Story

As a service provider of the [ELF4J](https://github.com/elf4j/elf4j) SPI, I want to bind the logging capabilities of
LOGBACK to the ELF4J client application via the
Java [Service Provider Framework](https://docs.oracle.com/javase/8/docs/api/java/util/ServiceLoader.html), so that any
application using the ELF4J API for logging can opt to use LOGBACK at deployment time without code change.
As an application developer using the [ELF4J](https://github.com/elf4j/elf4j) API, I want to have the option of
selecting [LOGBACK](https://logback.qos.ch/) as my log engine, at application deploy time without code change or
re-compile.

## Prerequisite

Java 8+

## Get it...
## Get It...

[![Maven Central](https://img.shields.io/maven-central/v/io.github.elf4j/elf4j-logback.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22io.github.elf4j%22%20AND%20a:%22elf4j-logback%22)

## Use it...
## Use It...

If you are using the [ELF4J API](https://github.com/elf4j/elf4j) for logging, and wish to select or
change to use LOGBACK as the run-time implementation, then simply pack this binding JAR in the classpath when the
application deploys. No code change needed. At compile time, the client code is unaware of this run-time logging service
provider. With the ELF4J facade, opting for LOGBACK as the logging implementation is a deployment-time decision.
If you are using the [ELF4J API](https://github.com/elf4j/elf4j) for logging, and wish to select or change to use
LOGBACK as the run-time log engine, then simply pack this serivce provider in the classpath when the application
deploys. No code change needed. At compile time, the client code is unaware of this run-time logging service provider.
With the ELF4J facade, opting for LOGBACK as the logging implementation is a deployment-time decision.

The usual [LOGBACK configuration](https://logback.qos.ch/manual/configuration.html) applies.

Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

<groupId>io.github.elf4j</groupId>
<artifactId>elf4j-logback</artifactId>
<version>8.0.1</version>
<version>8.0.2</version>

<packaging>jar</packaging>
<name>elf4j-logback</name>
Expand Down Expand Up @@ -67,7 +67,7 @@
<dependency>
<groupId>io.github.elf4j</groupId>
<artifactId>elf4j</artifactId>
<version>2.0.6</version>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>net.jcip</groupId>
Expand Down
36 changes: 6 additions & 30 deletions src/main/java/elf4j/logback/LogbackLogger.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,28 +113,11 @@ private static Object[] supply(Object[] objects) {
}

@Override
public Logger atDebug() {
return atLevel(DEBUG);
}

@Override
public Logger atError() {
return atLevel(ERROR);
}

@Override
public Logger atInfo() {
return atLevel(INFO);
}

@Override
public Logger atTrace() {
return atLevel(TRACE);
}

@Override
public Logger atWarn() {
return atLevel(WARN);
public Logger atLevel(Level level) {
if (this.level == level) {
return this;
}
return level == OFF ? NoopLogger.OFF : getLogger(this.name, level);
}

@Override
Expand Down Expand Up @@ -187,17 +170,10 @@ public void log(Throwable t, String message, Object... args) {
nativeLogger.log(null, FQCN, LEVEL_MAP.get(this.level), message, supply(args), t);
}

public String getName() {
String getName() {
return name;
}

private Logger atLevel(Level level) {
if (this.level == level) {
return this;
}
return level == OFF ? NoopLogger.OFF : getLogger(this.name, level);
}

private static class CallStack {

static StackTraceElement mostRecentCallerOf(@NonNull Class<?> calleeClass) {
Expand Down

0 comments on commit 8b20e97

Please sign in to comment.