Logger不打印日志,缺少配置文件所致,因此在资源目录下添加一个log4j.properties日志文件,内容如下:
##########Set Log Levels###############
log4j.rootLogger = ERROR, console
######### 输出到控制台 ####################
log4j.appender.console = org.apache.log4j.ConsoleAppender
log4j.appender.console.Target = System.err
log4j.appender.console.layout = org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern = %d{ABSOLUTE}%5p%c{ 1 :%L-%m%n