类 Loggers
java.util.logging.Logger). By default, the Console fallback is used. To use
the JDK loggers, set the "bytekit.logging.fallback"
System property to "JDK".
One can also force the implementation by using the "useXXX" static methods:
useConsoleLoggers(), useVerboseConsoleLoggers(),
useJdkLoggers() and useSl4jLoggers() (which may throw an
Exception if the library isn't on the classpath). Note that the system
property method above is preferred, as no cleanup of the logger factory
initialized at startup is attempted by the useXXX methods.
-
字段概要
字段修饰符和类型字段说明static final StringThe system property that determines which fallback implementation to use for loggers when SLF4J isn't available. -
方法概要
修饰符和类型方法说明static LoggerGet aLogger, backed by SLF4J if present on the classpath or falling back tojava.util.logging.Logger.static LoggerGet aLogger.static final voidAttempt to activate the bestbytekit Loggerfactory, by first attempting to use the SLF4J one, then falling back to either Console logging orjava.util.logging.Logger).static final voidForce the usage of Console-basedLoggers, even if SLF4J is available on the classpath.static final voidForce the usage of JDK-basedLoggers, even if SLF4J is available on the classpath.static final voidForce the usage of SL4J-basedLoggers, throwing an exception if SLF4J isn't available on the classpath.static final voidForce the usage of Console-basedLoggers, even if SLF4J is available on the classpath.
-
字段详细资料
-
FALLBACK_PROPERTY
The system property that determines which fallback implementation to use for loggers when SLF4J isn't available. UseJDKfor the JDK-backed logging and anything else for Console-based (the default).- 另请参阅:
-
-
方法详细资料
-
resetLoggerFactory
public static final void resetLoggerFactory()Attempt to activate the bestbytekit Loggerfactory, by first attempting to use the SLF4J one, then falling back to either Console logging orjava.util.logging.Logger). By default, the Console fallback is used. To fallback to the JDK loggers, set the "bytekit.logging.fallback"System propertyto "JDK".- 另请参阅:
-
useConsoleLoggers
public static final void useConsoleLoggers()Force the usage of Console-basedLoggers, even if SLF4J is available on the classpath. Console loggers will outputERRORandWARNlevels toSystem.errand levels below toSystem.out. All levels except TRACE and DEBUG are considered enabled. TRACE and DEBUG are omitted.The previously active logger factory is simply replaced without any particular clean-up.
-
useVerboseConsoleLoggers
public static final void useVerboseConsoleLoggers()Force the usage of Console-basedLoggers, even if SLF4J is available on the classpath. Console loggers will outputERRORandWARNlevels toSystem.errand levels below toSystem.out. All levels (including TRACE and DEBUG) are considered enabled.The previously active logger factory is simply replaced without any particular clean-up.
-
useJdkLoggers
public static final void useJdkLoggers()Force the usage of JDK-basedLoggers, even if SLF4J is available on the classpath.The previously active logger factory is simply replaced without any particular clean-up.
-
useSl4jLoggers
public static final void useSl4jLoggers()Force the usage of SL4J-basedLoggers, throwing an exception if SLF4J isn't available on the classpath. Prefer usingresetLoggerFactory()as it will fallback in the later case.The previously active logger factory is simply replaced without any particular clean-up.
-
getLogger
Get aLogger.For a notion of how the backing implementation is chosen, see
resetLoggerFactory()(or call one of theuseXxxLoggersmethods).- 参数:
name- the category or logger name to use- 返回:
- a new
Loggerinstance
-
getLogger
Get aLogger, backed by SLF4J if present on the classpath or falling back tojava.util.logging.Logger.
-