SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".

控制台打印信息

SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

在 pom 中添加

<!-- log -->
   <!-- https://mvnrepository.com/artifact/log4j/log4j -->
	<dependency>
	    <groupId>log4j</groupId>
	    <artifactId>log4j</artifactId>
	    <version>1.2.17</version>
	</dependency>
	<dependency>
	    <groupId>org.slf4j</groupId>
	    <artifactId>slf4j-api</artifactId>
	    <version>1.7.25</version>
	</dependency>
	<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-log4j12 -->
	<dependency>
	    <groupId>org.slf4j</groupId>
	    <artifactId>slf4j-log4j12</artifactId>
	    <version>1.7.25</version>
	    <!-- <scope>test</scope> -->
	</dependency>

新建 log4j.properties 内容简单如下

#ERROR、WARN、INFO、DEBUG
log4j.rootLogger=debug,stdout
LEVEL=DEBUG
log4j.logger.com.ibatis=${LEVEL}
log4j.logger.com.ibatis.common.jdbc.SimpleDataSource=${LEVEL}
log4j.logger.com.ibatis.common.jdbc.ScriptRunner=${LEVEL}
log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate=${LEVEL}
log4j.logger.java.sql.Connection=${LEVEL}
log4j.logger.java.sql.Statement=${LEVEL}
#log4j.logger.java.sql.PreparedStatement=${LEVEL}
log4j.logger.java.sql.ResultSet=${LEVEL}
#log4j.logger.redis.clients.jedis=${LEVEL}
log4j.logger.org.springframework=ERROR
log4j.logger.org.compass=${LEVEL}

### direct log messages to stdout ###
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} %5p %c{1}:%L - %m%n

另外对于 log4j1.x ,http://logging.apache.org/log4j/1.2/faq.html#noconfig 写到

On August 5, 2015 the Logging Services Project Management Committee announced that Log4j 1.x had reached end of life. For complete text of the announcement please see the Apache Blog. Users of Log4j 1 are recommended to upgrade to Apache Log4j 2.

大概意思是:2015年8月5日 项目管理委员会宣布 log4j 1.x 已经走到生命尽头,有关公告的完整内容,请参阅Apache博客。建议log4j 1的用户升级到apache log4j 2。

log4j2 链接:http://logging.apache.org/log4j/2.x/index.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值