Package migratedb.v1.core.api.logging
Class LogSystems
java.lang.Object
migratedb.v1.core.api.logging.LogSystems
Pre-defined log system names and auto-detection.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringorg.apache.commons.loggingsystem.static final StringAuto-detect based on environment.static final StringAn alias that means the fallback logger will be used (this library has no opinion on what a "console" log should be).static final Stringjava.util.loggingsystem.static final StringSuppresses all log messages.static final Stringorg.slf4jsystem. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic LogSystemautoDetect(ClassLoader classLoader, @Nullable LogSystem fallback) Auto-detects the "best" available log system and returns an instance of it.static LogSystemcustom(String className, ClassLoader classLoader) Instantiates a class that implementsLogSystem.static LogSystemfromStrings(Set<String> logSystemNames, ClassLoader classLoader, @Nullable LogSystem fallback) Creates a log system that forwards logging calls to all log system names inlogSystemNames.
-
Field Details
-
APACHE_COMMONS
org.apache.commons.loggingsystem.- See Also:
-
AUTO_DETECT
Auto-detect based on environment. SeeautoDetect(ClassLoader, LogSystem).- See Also:
-
JAVA_UTIL
java.util.loggingsystem.- See Also:
-
SLF4J
org.slf4jsystem.- See Also:
-
CONSOLE
An alias that means the fallback logger will be used (this library has no opinion on what a "console" log should be).- See Also:
-
NONE
Suppresses all log messages.- See Also:
-
-
Constructor Details
-
LogSystems
public LogSystems()
-
-
Method Details
-
fromStrings
public static LogSystem fromStrings(Set<String> logSystemNames, ClassLoader classLoader, @Nullable LogSystem fallback) Creates a log system that forwards logging calls to all log system names inlogSystemNames. Each log system name must either be one of the string constants in this class or the fully qualified name of a class that implementsLogSystemand has a public no-arg constructor.- Parameters:
logSystemNames- The log system names to parseclassLoader- Used to instantiate classes by namefallback- Used forAUTO_DETECTandCONSOLE(the latter being a direct alias for it)- Returns:
- Log system that delegates to all log systems identified by
logSystemNames.
-
custom
Instantiates a class that implementsLogSystem.- Parameters:
className- Fully qualified name of class to instantiate. Class must have a public no-arg constructor.classLoader- Class loader to use.- Returns:
- The custom log system.
-
autoDetect
Auto-detects the "best" available log system and returns an instance of it. The order of precedence is:- If one of the supported logging libraries is found via
classLoader, use it. - If
fallbackis non-null, use that. - Use
java.util.logging.
- Parameters:
classLoader- Used to check for the presence of supported logging libraries.fallback- Log system to use overjava.util.logging- Returns:
- Auto-detected log system.
- If one of the supported logging libraries is found via
-