項目中常常需要日志對象logger;
總是在代碼的前面部分放上這段代碼private final Logger logger = LoggerFactory.getLogger(AdController.class
這段代碼調用了org.slf4j.LoggerFactory
public static Logger getLogger(Class clazz) {
return getLogger(clazz.getName());
}
<a href="http://blog.csdn.net/zjlgdxzzw/article/details/45093607#" target="_blank">copy</a>
public static Logger getLogger(String name) {
ILoggerFactory iLoggerFactory = getILoggerFactory();
return iLoggerFactory.getLogger(name);
本文轉自建波李 51CTO部落格,原文連結:http://blog.51cto.com/jianboli/1904028,如需轉載請自行聯系原作者