1.pom.xml 添加log4j依赖
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
2.log4j.properties 编写
### set log levels ALL<DEBUG<INFO<WARN<ERROR<FATAL<OFF\uFF0C\u4E0D\u533A\u5206\u5927\u5C0F\u5199 ###
#\u5047\u8BBE\u4E3AWARN \u610F\u5473\u53EA\u6709WARN,ERROR,FATAL\u8F93\u51FA
#log4j.rootLogger=DEBUG,console,D,E,F
log4j.rootLogger=INFO,console,D,E,F
#log4j.rootLogger=WARN,D,E,F
log4j.appender.console = org.apache.log4j.ConsoleAppender
log4j.appender.console.Target = System.out
log4j.appender.console.layout = org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern = %d{ABSOLUTE} %5p %c{1}:%L - %m%n
#\u6309\u65E5\u671F\u6BCF\u5929\u4EA7\u751F\u4E00\u4E2A\u65E5\u5FD7\u6587\u4EF6
#log4j.appender.D = or