java 如何陪logger 打印sql日志
1个回答
展开全部
测试过,只配置这两行,就有
log4j.logger.java.sql=DEBUG
log4j.logger.com.ibatis=DEBUG
130506 190605.357 DEBUG [BaseJdbcLogger.java,132] - ooo Using Connection [com.mysql.jdbc.JDBC4Connection@48082751]
130506 190605.362 DEBUG [BaseJdbcLogger.java,132] - ==> Preparing: select * from t_blog where id = ?
130506 190605.579 DEBUG [BaseJdbcLogger.java,132] - ==> Parameters: 1(Integer)
130506 190605.729 DEBUG [BaseJdbcLogger.java,132] - ooo Using Connection [com.mysql.jdbc.JDBC4Connection@48082751]
130506 190605.731 DEBUG [BaseJdbcLogger.java,132] - ==> Preparing: select * from t_comment where blog_id = ?
130506 190605.733 DEBUG [BaseJdbcLogger.java,132] - ==> Parameters: 1(Integer)
130506 190605.769 DEBUG [BlogDaoIBatis.java,38] - blog=id=1, author=test1, createtime=Sat Mar 30 09:00:00 CST 2013, comments=[id=1, content=
test1 content, createtime=Sat Mar 30 09:00:00 CST 2013, blog=null, id=2, content=test2 content, createtime=Sat Mar 30 09:01:00 CST 2013, blo
g=null]
log4j.logger.java.sql=DEBUG
log4j.logger.com.ibatis=DEBUG
130506 190605.357 DEBUG [BaseJdbcLogger.java,132] - ooo Using Connection [com.mysql.jdbc.JDBC4Connection@48082751]
130506 190605.362 DEBUG [BaseJdbcLogger.java,132] - ==> Preparing: select * from t_blog where id = ?
130506 190605.579 DEBUG [BaseJdbcLogger.java,132] - ==> Parameters: 1(Integer)
130506 190605.729 DEBUG [BaseJdbcLogger.java,132] - ooo Using Connection [com.mysql.jdbc.JDBC4Connection@48082751]
130506 190605.731 DEBUG [BaseJdbcLogger.java,132] - ==> Preparing: select * from t_comment where blog_id = ?
130506 190605.733 DEBUG [BaseJdbcLogger.java,132] - ==> Parameters: 1(Integer)
130506 190605.769 DEBUG [BlogDaoIBatis.java,38] - blog=id=1, author=test1, createtime=Sat Mar 30 09:00:00 CST 2013, comments=[id=1, content=
test1 content, createtime=Sat Mar 30 09:00:00 CST 2013, blog=null, id=2, content=test2 content, createtime=Sat Mar 30 09:01:00 CST 2013, blo
g=null]
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |