mirror of https://github.com/qos-ch/slf4j
minor code cleanups
- more private final fields - avoiding C-style array declarations - few typos, notably JPlarformLogger -> JPlatformLogger Signed-off-by: Davide Angelocola <davide.angelocola@gmail.com>
This commit is contained in:
parent
d0836be06f
commit
6e784e4ca3
|
|
@ -43,7 +43,7 @@ public class SLF4JLocationAwareLog implements Log, Serializable {
|
||||||
|
|
||||||
// in both Log4jLogger and Jdk14Logger classes in the original JCL, the
|
// in both Log4jLogger and Jdk14Logger classes in the original JCL, the
|
||||||
// logger instance is transient
|
// logger instance is transient
|
||||||
private transient LocationAwareLogger logger;
|
private final transient LocationAwareLogger logger;
|
||||||
|
|
||||||
private static final String FQCN = SLF4JLocationAwareLog.class.getName();
|
private static final String FQCN = SLF4JLocationAwareLog.class.getName();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ public class SLF4JLog implements Log, Serializable {
|
||||||
|
|
||||||
// in both Log4jLogger and Jdk14Logger classes in the original JCL, the
|
// in both Log4jLogger and Jdk14Logger classes in the original JCL, the
|
||||||
// logger instance is transient
|
// logger instance is transient
|
||||||
private transient Logger logger;
|
private final transient Logger logger;
|
||||||
|
|
||||||
public SLF4JLog(Logger logger) {
|
public SLF4JLog(Logger logger) {
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ public class SLF4JLogFactory extends LogFactory {
|
||||||
while (keys.hasMoreElements()) {
|
while (keys.hasMoreElements()) {
|
||||||
names.add((String) keys.nextElement());
|
names.add((String) keys.nextElement());
|
||||||
}
|
}
|
||||||
String results[] = new String[names.size()];
|
String[] results = new String[names.size()];
|
||||||
for (int i = 0; i < results.length; i++) {
|
for (int i = 0; i < results.length; i++) {
|
||||||
results[i] = (String) names.get(i);
|
results[i] = (String) names.get(i);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -174,8 +174,8 @@ public class SLF4JBridgeHandler extends Handler {
|
||||||
public static void removeHandlersForRootLogger() {
|
public static void removeHandlersForRootLogger() {
|
||||||
java.util.logging.Logger rootLogger = getRootLogger();
|
java.util.logging.Logger rootLogger = getRootLogger();
|
||||||
java.util.logging.Handler[] handlers = rootLogger.getHandlers();
|
java.util.logging.Handler[] handlers = rootLogger.getHandlers();
|
||||||
for (int i = 0; i < handlers.length; i++) {
|
for (Handler handler : handlers) {
|
||||||
rootLogger.removeHandler(handlers[i]);
|
rootLogger.removeHandler(handler);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,12 +45,12 @@ public class Category {
|
||||||
|
|
||||||
private static final String CATEGORY_FQCN = Category.class.getName();
|
private static final String CATEGORY_FQCN = Category.class.getName();
|
||||||
|
|
||||||
private String name;
|
private final String name;
|
||||||
|
|
||||||
protected org.slf4j.Logger slf4jLogger;
|
protected org.slf4j.Logger slf4jLogger;
|
||||||
private org.slf4j.spi.LocationAwareLogger locationAwareLogger;
|
private org.slf4j.spi.LocationAwareLogger locationAwareLogger;
|
||||||
|
|
||||||
private static Marker FATAL_MARKER = MarkerFactory.getMarker("FATAL");
|
private static final Marker FATAL_MARKER = MarkerFactory.getMarker("FATAL");
|
||||||
|
|
||||||
Category(String name) {
|
Category(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ import java.util.concurrent.ConcurrentMap;
|
||||||
class Log4jLoggerFactory {
|
class Log4jLoggerFactory {
|
||||||
|
|
||||||
// String, Logger
|
// String, Logger
|
||||||
private static ConcurrentMap<String, Logger> log4jLoggers = new ConcurrentHashMap<>();
|
private static final ConcurrentMap<String, Logger> log4jLoggers = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
public static Logger getLogger(String name) {
|
public static Logger getLogger(String name) {
|
||||||
org.apache.log4j.Logger instance = log4jLoggers.get(name);
|
org.apache.log4j.Logger instance = log4jLoggers.get(name);
|
||||||
|
|
|
||||||
|
|
@ -182,7 +182,7 @@ public final class LoggerFactory {
|
||||||
|
|
||||||
// We need to use the name of the StaticLoggerBinder class, but we can't
|
// We need to use the name of the StaticLoggerBinder class, but we can't
|
||||||
// reference the class itself.
|
// reference the class itself.
|
||||||
private static String STATIC_LOGGER_BINDER_PATH = "org/slf4j/impl/StaticLoggerBinder.class";
|
private static final String STATIC_LOGGER_BINDER_PATH = "org/slf4j/impl/StaticLoggerBinder.class";
|
||||||
|
|
||||||
static Set<URL> findPossibleStaticLoggerBinderPathSet() {
|
static Set<URL> findPossibleStaticLoggerBinderPathSet() {
|
||||||
// use Set instead of list in order to deal with bug #138
|
// use Set instead of list in order to deal with bug #138
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ import java.util.*;
|
||||||
*/
|
*/
|
||||||
public class BasicMDCAdapter implements MDCAdapter {
|
public class BasicMDCAdapter implements MDCAdapter {
|
||||||
|
|
||||||
private InheritableThreadLocal<Map<String, String>> inheritableThreadLocal = new InheritableThreadLocal<Map<String, String>>() {
|
private final InheritableThreadLocal<Map<String, String>> inheritableThreadLocal = new InheritableThreadLocal<Map<String, String>>() {
|
||||||
@Override
|
@Override
|
||||||
protected Map<String, String> childValue(Map<String, String> parentValue) {
|
protected Map<String, String> childValue(Map<String, String> parentValue) {
|
||||||
if (parentValue == null) {
|
if (parentValue == null) {
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ public class BasicMarker implements Marker {
|
||||||
|
|
||||||
private static final long serialVersionUID = -2849567615646933777L;
|
private static final long serialVersionUID = -2849567615646933777L;
|
||||||
private final String name;
|
private final String name;
|
||||||
private List<Marker> referenceList = new CopyOnWriteArrayList<>();
|
private final List<Marker> referenceList = new CopyOnWriteArrayList<>();
|
||||||
|
|
||||||
BasicMarker(String name) {
|
BasicMarker(String name) {
|
||||||
if (name == null) {
|
if (name == null) {
|
||||||
|
|
@ -128,9 +128,9 @@ public class BasicMarker implements Marker {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String OPEN = "[ ";
|
private static final String OPEN = "[ ";
|
||||||
private static String CLOSE = " ]";
|
private static final String CLOSE = " ]";
|
||||||
private static String SEP = ", ";
|
private static final String SEP = ", ";
|
||||||
|
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (this == obj)
|
if (this == obj)
|
||||||
|
|
|
||||||
|
|
@ -33,9 +33,9 @@ public class FormattingTuple {
|
||||||
|
|
||||||
static public FormattingTuple NULL = new FormattingTuple(null);
|
static public FormattingTuple NULL = new FormattingTuple(null);
|
||||||
|
|
||||||
private String message;
|
private final String message;
|
||||||
private Throwable throwable;
|
private final Throwable throwable;
|
||||||
private Object[] argArray;
|
private final Object[] argArray;
|
||||||
|
|
||||||
public FormattingTuple(String message) {
|
public FormattingTuple(String message) {
|
||||||
this(message, null, null);
|
this(message, null, null);
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,9 @@ public class NOP_FallbackServiceProvider implements SLF4JServiceProvider {
|
||||||
// to avoid constant folding by the compiler, this field must *not* be final
|
// to avoid constant folding by the compiler, this field must *not* be final
|
||||||
public static String REQUESTED_API_VERSION = "2.0.99"; // !final
|
public static String REQUESTED_API_VERSION = "2.0.99"; // !final
|
||||||
|
|
||||||
private ILoggerFactory loggerFactory = new NOPLoggerFactory();
|
private final ILoggerFactory loggerFactory = new NOPLoggerFactory();
|
||||||
private IMarkerFactory markerFactory = new BasicMarkerFactory();
|
private final IMarkerFactory markerFactory = new BasicMarkerFactory();
|
||||||
private MDCAdapter mdcAdapter = new NOPMDCAdapter();
|
private final MDCAdapter mdcAdapter = new NOPMDCAdapter();
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ public class SubstituteLogger implements Logger {
|
||||||
private Boolean delegateEventAware;
|
private Boolean delegateEventAware;
|
||||||
private Method logMethodCache;
|
private Method logMethodCache;
|
||||||
private EventRecodingLogger eventRecodingLogger;
|
private EventRecodingLogger eventRecodingLogger;
|
||||||
private Queue<SubstituteLoggingEvent> eventQueue;
|
private final Queue<SubstituteLoggingEvent> eventQueue;
|
||||||
|
|
||||||
public final boolean createdPostInitialization;
|
public final boolean createdPostInitialization;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,9 @@ import org.slf4j.spi.MDCAdapter;
|
||||||
import org.slf4j.spi.SLF4JServiceProvider;
|
import org.slf4j.spi.SLF4JServiceProvider;
|
||||||
|
|
||||||
public class SubstituteServiceProvider implements SLF4JServiceProvider {
|
public class SubstituteServiceProvider implements SLF4JServiceProvider {
|
||||||
private SubstituteLoggerFactory loggerFactory = new SubstituteLoggerFactory();
|
private final SubstituteLoggerFactory loggerFactory = new SubstituteLoggerFactory();
|
||||||
private IMarkerFactory markerFactory = new BasicMarkerFactory();
|
private final IMarkerFactory markerFactory = new BasicMarkerFactory();
|
||||||
private MDCAdapter mdcAdapter = new BasicMDCAdapter();
|
private final MDCAdapter mdcAdapter = new BasicMDCAdapter();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ILoggerFactory getLoggerFactory() {
|
public ILoggerFactory getLoggerFactory() {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
package org.slf4j.spi;
|
package org.slf4j.spi;
|
||||||
|
|
||||||
|
import org.slf4j.event.LoggingEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Additional interface to {@link LoggingEventBuilder} and
|
* Additional interface to {@link LoggingEventBuilder} and
|
||||||
* {@link qorg.slf4j.event.LoggingEvent LoggingEvent}.
|
* {@link org.slf4j.event.LoggingEvent LoggingEvent}.
|
||||||
*
|
*
|
||||||
* Implementations of {@link LoggingEventBuilder} and {@link LoggingEvent} may optionally
|
* Implementations of {@link LoggingEventBuilder} and {@link LoggingEvent} may optionally
|
||||||
* implement {@link CallerBoundaryAware} in order to support caller info extraction.
|
* implement {@link CallerBoundaryAware} in order to support caller info extraction.
|
||||||
*
|
*
|
||||||
* This interface is intended for use by logging backends or logging bridges.
|
* This interface is intended for use by logging backends or logging bridges.
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package org.slf4j.spi;
|
||||||
import org.slf4j.ILoggerFactory;
|
import org.slf4j.ILoggerFactory;
|
||||||
import org.slf4j.IMarkerFactory;
|
import org.slf4j.IMarkerFactory;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.slf4j.MDC;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This interface based on {@link java.util.ServiceLoader} paradigm.
|
* This interface based on {@link java.util.ServiceLoader} paradigm.
|
||||||
|
|
@ -31,7 +32,7 @@ public interface SLF4JServiceProvider {
|
||||||
public IMarkerFactory getMarkerFactory();
|
public IMarkerFactory getMarkerFactory();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the instnace of {@link MDCAdapter} that
|
* Return the instance of {@link MDCAdapter} that
|
||||||
* {@link MDC} should bind to.
|
* {@link MDC} should bind to.
|
||||||
*
|
*
|
||||||
* @return instance of {@link MDCAdapter}
|
* @return instance of {@link MDCAdapter}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ import java.util.concurrent.CyclicBarrier;
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
|
||||||
public class LoggerAccessingThread extends Thread {
|
public class LoggerAccessingThread extends Thread {
|
||||||
private static int LOOP_LEN = 32;
|
private static final int LOOP_LEN = 32;
|
||||||
|
|
||||||
final CyclicBarrier barrier;
|
final CyclicBarrier barrier;
|
||||||
final int count;
|
final int count;
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class SubstituteLoggerFactoryTest {
|
public class SubstituteLoggerFactoryTest {
|
||||||
private SubstituteLoggerFactory factory = new SubstituteLoggerFactory();
|
private final SubstituteLoggerFactory factory = new SubstituteLoggerFactory();
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFactory() {
|
public void testFactory() {
|
||||||
|
|
|
||||||
|
|
@ -135,8 +135,8 @@ public class LogTransformer implements ClassFileTransformer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String level;
|
private final String level;
|
||||||
private String levelEnabled;
|
private final String levelEnabled;
|
||||||
|
|
||||||
private LogTransformer(Builder builder) {
|
private LogTransformer(Builder builder) {
|
||||||
String s = "WARNING: javassist not available on classpath for javaagent, log statements will not be added";
|
String s = "WARNING: javassist not available on classpath for javaagent, log statements will not be added";
|
||||||
|
|
@ -156,10 +156,10 @@ public class LogTransformer implements ClassFileTransformer {
|
||||||
this.levelEnabled = "is" + builder.level.substring(0, 1).toUpperCase() + builder.level.substring(1) + "Enabled";
|
this.levelEnabled = "is" + builder.level.substring(0, 1).toUpperCase() + builder.level.substring(1) + "Enabled";
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean addEntryExit;
|
private final boolean addEntryExit;
|
||||||
// private boolean addVariableAssignment;
|
// private boolean addVariableAssignment;
|
||||||
private boolean verbose;
|
private final boolean verbose;
|
||||||
private String[] ignore;
|
private final String[] ignore;
|
||||||
|
|
||||||
public byte[] transform(ClassLoader loader, String className, Class<?> clazz, ProtectionDomain domain, byte[] bytes) {
|
public byte[] transform(ClassLoader loader, String className, Class<?> clazz, ProtectionDomain domain, byte[] bytes) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ public class SortAndPruneComposites {
|
||||||
int[] sortedArray = sort();
|
int[] sortedArray = sort();
|
||||||
// start a new stopwatch called PRUNE_COMPOSITES
|
// start a new stopwatch called PRUNE_COMPOSITES
|
||||||
sortProfiler.start("PRUNE_COMPOSITES");
|
sortProfiler.start("PRUNE_COMPOSITES");
|
||||||
int result[] = pruneComposites(sortedArray);
|
int[] result = pruneComposites(sortedArray);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,28 +31,28 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages instances of {@link SLF4JPlarformLogger}.
|
* Manages instances of {@link SLF4JPlatformLogger}.
|
||||||
*
|
*
|
||||||
* @since 1.3.0
|
* @since 1.3.0
|
||||||
* @author Ceki
|
* @author Ceki
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class SLF4JPlarformLoggerFactory {
|
public class SLF4JPlarformLoggerFactory {
|
||||||
ConcurrentMap<String, SLF4JPlarformLogger> loggerMap = new ConcurrentHashMap<>();
|
ConcurrentMap<String, SLF4JPlatformLogger> loggerMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return an appropriate {@link SLF4JPlarformLogger} instance by name.
|
* Return an appropriate {@link SLF4JPlatformLogger} instance by name.
|
||||||
*/
|
*/
|
||||||
public SLF4JPlarformLogger getLogger(String loggerName) {
|
public SLF4JPlatformLogger getLogger(String loggerName) {
|
||||||
|
|
||||||
|
|
||||||
SLF4JPlarformLogger spla = loggerMap.get(loggerName);
|
SLF4JPlatformLogger spla = loggerMap.get(loggerName);
|
||||||
if (spla != null) {
|
if (spla != null) {
|
||||||
return spla;
|
return spla;
|
||||||
} else {
|
} else {
|
||||||
Logger slf4jLogger = LoggerFactory.getLogger(loggerName);
|
Logger slf4jLogger = LoggerFactory.getLogger(loggerName);
|
||||||
SLF4JPlarformLogger newInstance = new SLF4JPlarformLogger(slf4jLogger);
|
SLF4JPlatformLogger newInstance = new SLF4JPlatformLogger(slf4jLogger);
|
||||||
SLF4JPlarformLogger oldInstance = loggerMap.putIfAbsent(loggerName, newInstance);
|
SLF4JPlatformLogger oldInstance = loggerMap.putIfAbsent(loggerName, newInstance);
|
||||||
return oldInstance == null ? newInstance : oldInstance;
|
return oldInstance == null ? newInstance : oldInstance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,13 +37,13 @@ import org.slf4j.spi.LoggingEventBuilder;
|
||||||
* Adapts {@link Logger} to {@link System.Logger}.
|
* Adapts {@link Logger} to {@link System.Logger}.
|
||||||
* @since 2.0.0
|
* @since 2.0.0
|
||||||
*/
|
*/
|
||||||
class SLF4JPlarformLogger implements System.Logger {
|
class SLF4JPlatformLogger implements System.Logger {
|
||||||
|
|
||||||
static private String PRESUMED_CALLER_BOUNDARY = System.Logger.class.getName();
|
static private final String PRESUMED_CALLER_BOUNDARY = System.Logger.class.getName();
|
||||||
|
|
||||||
private final Logger slf4jLogger;
|
private final Logger slf4jLogger;
|
||||||
|
|
||||||
public SLF4JPlarformLogger(Logger logger) {
|
public SLF4JPlatformLogger(Logger logger) {
|
||||||
this.slf4jLogger = requireNonNull(logger);
|
this.slf4jLogger = requireNonNull(logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -52,7 +52,7 @@ public class SLF4JSystemLoggerFinder extends System.LoggerFinder {
|
||||||
// is updated to forward a module, we should do that here.
|
// is updated to forward a module, we should do that here.
|
||||||
//
|
//
|
||||||
// [1] https://openjdk.java.net/jeps/264
|
// [1] https://openjdk.java.net/jeps/264
|
||||||
SLF4JPlarformLogger adapter = platformLoggerFactory.getLogger(name);
|
SLF4JPlatformLogger adapter = platformLoggerFactory.getLogger(name);
|
||||||
return adapter;
|
return adapter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -216,7 +216,7 @@ public final class JDK14LoggerAdapter extends LegacyAbstractLogger implements Lo
|
||||||
static String SUBSTITUE = SubstituteLogger.class.getName();
|
static String SUBSTITUE = SubstituteLogger.class.getName();
|
||||||
static String FLUENT = DefaultLoggingEventBuilder.class.getName();
|
static String FLUENT = DefaultLoggingEventBuilder.class.getName();
|
||||||
|
|
||||||
static String BARRIER_CLASSES[] = new String[] { SUPER_OF_SUPER, SUPER, SELF, SUBSTITUE, FLUENT };
|
static String[] BARRIER_CLASSES = new String[] { SUPER_OF_SUPER, SUPER, SELF, SUBSTITUE, FLUENT };
|
||||||
|
|
||||||
private boolean barrierMatch(String callerFQCN, String candidateClassName) {
|
private boolean barrierMatch(String callerFQCN, String candidateClassName) {
|
||||||
if (candidateClassName.equals(callerFQCN))
|
if (candidateClassName.equals(callerFQCN))
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ public class LoggerSerializationTest {
|
||||||
static class LoggerHolder implements Serializable {
|
static class LoggerHolder implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
private Logger log = LoggerFactory.getLogger(LoggerHolder.class);
|
private final Logger log = LoggerFactory.getLogger(LoggerHolder.class);
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "log=" + getLog();
|
return "log=" + getLog();
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import org.junit.Test;
|
||||||
|
|
||||||
public class MDCFriendTest {
|
public class MDCFriendTest {
|
||||||
|
|
||||||
private static Random random = new Random();
|
private static final Random random = new Random();
|
||||||
int diff = random.nextInt(1024 * 8);
|
int diff = random.nextInt(1024 * 8);
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
|
|
@ -58,8 +58,8 @@ public class MigratorFrame extends JFrame implements ActionListener {
|
||||||
static final int X_SIZE = 700;
|
static final int X_SIZE = 700;
|
||||||
static final int Y_SIZE = 400;
|
static final int Y_SIZE = 400;
|
||||||
|
|
||||||
private SpringLayout layoutManager = new SpringLayout();
|
private final SpringLayout layoutManager = new SpringLayout();
|
||||||
private SpringLayoutHelper slh = new SpringLayoutHelper(layoutManager, BASIC_PADDING);
|
private final SpringLayoutHelper slh = new SpringLayoutHelper(layoutManager, BASIC_PADDING);
|
||||||
|
|
||||||
private JLabel migrationLabel;
|
private JLabel migrationLabel;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ import java.util.regex.Pattern;
|
||||||
*/
|
*/
|
||||||
public class JCLRuleSet implements RuleSet {
|
public class JCLRuleSet implements RuleSet {
|
||||||
|
|
||||||
private ArrayList<ConversionRule> conversionRuleList;
|
private final ArrayList<ConversionRule> conversionRuleList;
|
||||||
|
|
||||||
public JCLRuleSet() {
|
public JCLRuleSet() {
|
||||||
// matching : import org.apache.commons.logging.LogFactory;
|
// matching : import org.apache.commons.logging.LogFactory;
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ import java.util.regex.Pattern;
|
||||||
*/
|
*/
|
||||||
public class JULRuleSet implements RuleSet {
|
public class JULRuleSet implements RuleSet {
|
||||||
|
|
||||||
private ArrayList<ConversionRule> conversionRuleList;
|
private final ArrayList<ConversionRule> conversionRuleList;
|
||||||
|
|
||||||
public JULRuleSet() {
|
public JULRuleSet() {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ import java.util.regex.Pattern;
|
||||||
|
|
||||||
public class Log4jRuleSet implements RuleSet {
|
public class Log4jRuleSet implements RuleSet {
|
||||||
|
|
||||||
private ArrayList<ConversionRule> conversionRuleList;
|
private final ArrayList<ConversionRule> conversionRuleList;
|
||||||
|
|
||||||
public Log4jRuleSet() {
|
public Log4jRuleSet() {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,8 +40,8 @@ public class MultiGroupConversionRule implements ConversionRule {
|
||||||
// our conversion reg-expressions
|
// our conversion reg-expressions
|
||||||
final private static int MAX_GROUPS = 10;
|
final private static int MAX_GROUPS = 10;
|
||||||
|
|
||||||
private Pattern pattern;
|
private final Pattern pattern;
|
||||||
private String[] replacementTable = new String[MAX_GROUPS];
|
private final String[] replacementTable = new String[MAX_GROUPS];
|
||||||
|
|
||||||
public MultiGroupConversionRule(Pattern pattern) {
|
public MultiGroupConversionRule(Pattern pattern) {
|
||||||
this.pattern = pattern;
|
this.pattern = pattern;
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ import java.util.Random;
|
||||||
|
|
||||||
public class RandomHelper {
|
public class RandomHelper {
|
||||||
|
|
||||||
private Random random = new Random(100);
|
private final Random random = new Random(100);
|
||||||
final char folderSeparator;
|
final char folderSeparator;
|
||||||
|
|
||||||
RandomHelper(char folderSeparator) {
|
RandomHelper(char folderSeparator) {
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ import org.slf4j.migrator.line.SingleConversionRule;
|
||||||
|
|
||||||
class TrivialMatcher implements RuleSet {
|
class TrivialMatcher implements RuleSet {
|
||||||
|
|
||||||
private ArrayList<ConversionRule> conversionRuleList;
|
private final ArrayList<ConversionRule> conversionRuleList;
|
||||||
|
|
||||||
public TrivialMatcher() {
|
public TrivialMatcher() {
|
||||||
// simple rule no capturing group is defined, we use default capturing group which is group zero
|
// simple rule no capturing group is defined, we use default capturing group which is group zero
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,9 @@ public class NOPServiceProvider implements SLF4JServiceProvider {
|
||||||
// to avoid constant folding by the compiler, this field must *not* be final
|
// to avoid constant folding by the compiler, this field must *not* be final
|
||||||
public static String REQUESTED_API_VERSION = "2.0.99"; // !final
|
public static String REQUESTED_API_VERSION = "2.0.99"; // !final
|
||||||
|
|
||||||
private ILoggerFactory loggerFactory = new NOPLoggerFactory();
|
private final ILoggerFactory loggerFactory = new NOPLoggerFactory();
|
||||||
private IMarkerFactory markerFactory = new BasicMarkerFactory();
|
private final IMarkerFactory markerFactory = new BasicMarkerFactory();
|
||||||
private MDCAdapter mdcAdapter = new NOPMDCAdapter();
|
private final MDCAdapter mdcAdapter = new NOPMDCAdapter();
|
||||||
|
|
||||||
public ILoggerFactory getLoggerFactory() {
|
public ILoggerFactory getLoggerFactory() {
|
||||||
return loggerFactory;
|
return loggerFactory;
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ public class MultithreadedInitializationTest {
|
||||||
|
|
||||||
final static int THREAD_COUNT = 4 + Runtime.getRuntime().availableProcessors() * 2;
|
final static int THREAD_COUNT = 4 + Runtime.getRuntime().availableProcessors() * 2;
|
||||||
|
|
||||||
private static AtomicLong EVENT_COUNT = new AtomicLong(0);
|
private static final AtomicLong EVENT_COUNT = new AtomicLong(0);
|
||||||
|
|
||||||
final CyclicBarrier barrier = new CyclicBarrier(THREAD_COUNT + 1);
|
final CyclicBarrier barrier = new CyclicBarrier(THREAD_COUNT + 1);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,7 @@ public class SimpleLogger extends LegacyAbstractLogger {
|
||||||
|
|
||||||
private static final long serialVersionUID = -632788891211436180L;
|
private static final long serialVersionUID = -632788891211436180L;
|
||||||
|
|
||||||
private static long START_TIME = System.currentTimeMillis();
|
private static final long START_TIME = System.currentTimeMillis();
|
||||||
|
|
||||||
protected static final int LOG_LEVEL_TRACE = LocationAwareLogger.TRACE_INT;
|
protected static final int LOG_LEVEL_TRACE = LocationAwareLogger.TRACE_INT;
|
||||||
protected static final int LOG_LEVEL_DEBUG = LocationAwareLogger.DEBUG_INT;
|
protected static final int LOG_LEVEL_DEBUG = LocationAwareLogger.DEBUG_INT;
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ public class SimpleLoggerConfiguration {
|
||||||
private static final boolean LEVEL_IN_BRACKETS_DEFAULT = false;
|
private static final boolean LEVEL_IN_BRACKETS_DEFAULT = false;
|
||||||
boolean levelInBrackets = LEVEL_IN_BRACKETS_DEFAULT;
|
boolean levelInBrackets = LEVEL_IN_BRACKETS_DEFAULT;
|
||||||
|
|
||||||
private static String LOG_FILE_DEFAULT = "System.err";
|
private static final String LOG_FILE_DEFAULT = "System.err";
|
||||||
private String logFile = LOG_FILE_DEFAULT;
|
private String logFile = LOG_FILE_DEFAULT;
|
||||||
OutputChoice outputChoice = null;
|
OutputChoice outputChoice = null;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,10 +39,10 @@ import org.slf4j.LoggerFactory;
|
||||||
*/
|
*/
|
||||||
public class MultithereadedExecutionTest {
|
public class MultithereadedExecutionTest {
|
||||||
|
|
||||||
private static int THREAD_COUNT = 2;
|
private static final int THREAD_COUNT = 2;
|
||||||
private Thread[] threads = new Thread[THREAD_COUNT];
|
private final Thread[] threads = new Thread[THREAD_COUNT];
|
||||||
|
|
||||||
private static long TEST_DURATION_IN_MILLIS = 100;
|
private static final long TEST_DURATION_IN_MILLIS = 100;
|
||||||
|
|
||||||
private final PrintStream oldOut = System.out;
|
private final PrintStream oldOut = System.out;
|
||||||
StateCheckingPrintStream scps = new StateCheckingPrintStream(oldOut);
|
StateCheckingPrintStream scps = new StateCheckingPrintStream(oldOut);
|
||||||
|
|
|
||||||
|
|
@ -339,10 +339,10 @@
|
||||||
|
|
||||||
<h3>February 19th, 2019 - Release of SLF4J 1.8.0-beta4</h3>
|
<h3>February 19th, 2019 - Release of SLF4J 1.8.0-beta4</h3>
|
||||||
|
|
||||||
<p class="highlight"t>In the 1.8.x series, SLF4J has been
|
<p class="highlight">In the 1.8.x series, SLF4J has been
|
||||||
modularized per <a
|
modularized per <a
|
||||||
href="http://openjdk.java.net/projects/jigsaw/spec/">JPMS/Jigsaw</a>
|
href="http://openjdk.java.net/projects/jigsaw/spec/">JPMS/Jigsaw</a>
|
||||||
specificaton. The resulting internal changes are <a class="big
|
specification. The resulting internal changes are <a class="big
|
||||||
bold" href="faq.html#changesInVersion18">detailed</a> in the FAQ
|
bold" href="faq.html#changesInVersion18">detailed</a> in the FAQ
|
||||||
page. </p>
|
page. </p>
|
||||||
|
|
||||||
|
|
@ -353,7 +353,7 @@
|
||||||
|
|
||||||
<p>In the 1.8.x series, SLF4J has been modularized
|
<p>In the 1.8.x series, SLF4J has been modularized
|
||||||
per <a href="http://openjdk.java.net/projects/jigsaw/spec/">JPMS/Jigsaw</a>
|
per <a href="http://openjdk.java.net/projects/jigsaw/spec/">JPMS/Jigsaw</a>
|
||||||
specificaton. The resulting internal changes are <a class="big
|
specification. The resulting internal changes are <a class="big
|
||||||
bold" href="faq.html#changesInVersion18">detailed</a> in the FAQ
|
bold" href="faq.html#changesInVersion18">detailed</a> in the FAQ
|
||||||
page. Moreover, SLF4J now requires Java 6 or later as
|
page. Moreover, SLF4J now requires Java 6 or later as
|
||||||
slf4j-api now relies on
|
slf4j-api now relies on
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue