Skip to content

Commit

Permalink
support slf4j 2.0.+
Browse files Browse the repository at this point in the history
  • Loading branch information
artsiomkorzun committed Jan 20, 2024
1 parent 2aef631 commit 5cfe8db
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 2 deletions.
10 changes: 9 additions & 1 deletion ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
# Change Log

## 3.0.5

- Support SLF4J 2.0.+.

## 3.0.4

- Support timestamp/date/time in nanoseconds.

## 3.0.3

- Support Java 17 (replaced usage of internal api to get address of direct ByteBuffer)
- Support Java 17 (replaced usage of internal api to get address of direct ByteBuffer).

## 3.0.2

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ project('gflog-jul') {
project('gflog-slf4j') {
dependencies {
api project(':gflog-api')
api 'org.slf4j:slf4j-api:1.7.36'
api 'org.slf4j:slf4j-api:2.0.11'
testImplementation project(':gflog-core')
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.epam.deltix.gflog.slf4j;

import org.slf4j.ILoggerFactory;
import org.slf4j.IMarkerFactory;
import org.slf4j.helpers.BasicMDCAdapter;
import org.slf4j.helpers.BasicMarkerFactory;
import org.slf4j.spi.MDCAdapter;
import org.slf4j.spi.SLF4JServiceProvider;

public final class Slf4jBridgeProvider implements SLF4JServiceProvider {

private static final String MAX_SUPPORTED_API_VERSION = "2.0.99";

private final Slf4jBridgeFactory loggerFactory = new Slf4jBridgeFactory();
private final BasicMarkerFactory markerFactory = new BasicMarkerFactory();
private final BasicMDCAdapter mdcAdapter = new BasicMDCAdapter();

@Override
public ILoggerFactory getLoggerFactory() {
return loggerFactory;
}

@Override
public IMarkerFactory getMarkerFactory() {
return markerFactory;
}

@Override
public MDCAdapter getMDCAdapter() {
return mdcAdapter;
}

@Override
public String getRequestedApiVersion() {
return MAX_SUPPORTED_API_VERSION;
}

@Override
public void initialize() {
// lazy initialization
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
com.epam.deltix.gflog.slf4j.Slf4jBridgeProvider

0 comments on commit 5cfe8db

Please sign in to comment.