make Slf4JLoggerFactory be singleton (#11253)

Motivation:

The current initialization of Slf4JLoggerFactory is not singleton.

Modification:

Use Slf4JLoggerFactory.INSTANCE to initialize Slf4JLoggerFactory.

Result:

The instance of Slf4JLoggerFactory became a singleton.
This commit is contained in:
old driver 2021-05-17 15:10:15 +08:00 committed by GitHub
parent d5c81d9a3e
commit 5178b2c7a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -59,7 +59,7 @@ public abstract class InternalLoggerFactory {
private static InternalLoggerFactory useSlf4JLoggerFactory(String name) {
try {
InternalLoggerFactory f = new Slf4JLoggerFactory(true);
InternalLoggerFactory f = Slf4JLoggerFactory.INSTANCE_WITH_NOP_CHECK;
f.newInstance(name).debug("Using SLF4J as the default logging framework");
return f;
} catch (LinkageError ignore) {

View File

@ -30,6 +30,8 @@ public class Slf4JLoggerFactory extends InternalLoggerFactory {
@SuppressWarnings("deprecation")
public static final InternalLoggerFactory INSTANCE = new Slf4JLoggerFactory();
static final InternalLoggerFactory INSTANCE_WITH_NOP_CHECK = new Slf4JLoggerFactory(true);
/**
* @deprecated Use {@link #INSTANCE} instead.
*/