- 添加依赖
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.4</version>
</dependency>
- 添加log4j核心配置文件—log4j.properties
\u5728src\uFF08\u6216\u76F8\u4F3C\u7684\u76EE\u5F55\uFF09\u4E0B\u521B\u5EFAlog4j.properties\u5982\u4E0B\uFF1A
# Global logging configuration
log4j.rootLogger=DEBUG, stdout
# Console output...
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n