1 . pom 依赖
<dependency> <groupId>org.slf4j</groupId> <artifactId>log4j-over-slf4j</artifactId> <version>1.7.25</version> </dependency>
2.项目中引用
import org.apache.log4j.Logger; private final static Logger LOGGER = Logger.getLogger(ApiCtrl.class);
3.项目中使用
LOGGER.info("-------------------resvServerCmd params -------------------:" + params.toString()); LOGGER.error("发生错误"+User); LOGGER.debug("debug");
来源:oschina
链接:https://my.oschina.net/daixingdeng/blog/4870301