Package org.slf4j
Class LoggerFactory
- java.lang.Object
-
- org.slf4j.LoggerFactory
-
public final class LoggerFactory extends java.lang.Object
TheLoggerFactory
is a utility class producing Loggers for various logging APIs, most notably for log4j, logback and JDK 1.4 logging. Other implementations such asNOPLogger
andSimpleLogger
are also supported.LoggerFactory
is essentially a wrapper around anILoggerFactory
instance bound withLoggerFactory
at compile time. Please note that all methods inLoggerFactory
are static.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ILoggerFactory
getILoggerFactory()
Return theILoggerFactory
instance in use.static Logger
getLogger(java.lang.Class<?> clazz)
Return a logger named corresponding to the class passed as parameter, using the statically boundILoggerFactory
instance.static Logger
getLogger(java.lang.String name)
Return a logger named according to the name parameter using the statically boundILoggerFactory
instance.
-
-
-
Method Detail
-
getLogger
public static Logger getLogger(java.lang.String name)
Return a logger named according to the name parameter using the statically boundILoggerFactory
instance.- Parameters:
name
- The name of the logger.- Returns:
- logger
-
getLogger
public static Logger getLogger(java.lang.Class<?> clazz)
Return a logger named corresponding to the class passed as parameter, using the statically boundILoggerFactory
instance.In case the the
clazz
parameter differs from the name of the caller as computed internally by SLF4J, a logger name mismatch warning will be printed but only if theslf4j.detectLoggerNameMismatch
system property is set to true. By default, this property is not set and no warnings will be printed even in case of a logger name mismatch.- Parameters:
clazz
- the returned logger will be named after clazz- Returns:
- logger
- See Also:
- Detected logger name mismatch
-
getILoggerFactory
public static ILoggerFactory getILoggerFactory()
Return theILoggerFactory
instance in use. ILoggerFactory instance is bound with this class at compile time.- Returns:
- the ILoggerFactory instance in use
-
-