Class LoggerFactory

public final class LoggerFactory
extends Object
The  LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for log4j, logback and JDK 1.4 logging. Other implementations such as  NOPLogger and  SimpleLogger are also supported.

LoggerFactory is essentially a wrapper around an ILoggerFactory instance bound with LoggerFactory at compile time.

Please note that all methods in LoggerFactory are static.

Method Detail

public static Logger getLogger(String name)
Return a logger named according to the name parameter using the statically bound  ILoggerFactory instance.
使用静态绑定的ILoggerFactory实例返回根据名称参数命名的日志记录器。
Parameters:
name - The name of the logger.
Returns:

logger


public static Logger getLogger(Class<?> clazz)
Return a logger named corresponding to the class passed as parameter, using the statically bound  ILoggerFactory instance.
Parameters:
clazz - the returned logger will be named after clazz
Returns:
logger

使用静态绑定的ILoggerFactory实例返回与作为参数传递的类对应的日志记录器。


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 the slf4j.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.


猜你喜欢

转载自blog.csdn.net/zerolaw/article/details/80945347