时间:2021-07-01 10:21:17 帮助过:10人阅读
<mapper namespace="mapperNS.user"> <select id="selectUser" parameterType="int" resultType="User"> <![CDATA[ select * from user where id = #{id} ]]> </select> </mapper>
打印结果
2013-12-27 13:16:56,335 DEBUG [mapperNS.user.selectUser] -ooo Using Connection [com.mysql.jdbc.JDBC4Connection@2d8eef25] 2013-12-27 13:16:56,344 DEBUG [mapperNS.user.selectUser] -==> Preparing: select * from user where id = ? 2013-12-27 13:16:56,408 DEBUG [mapperNS.user.selectUser] -==> Parameters: 1(String) 2013-12-27 13:16:56,430 TRACE [mapperNS.user.selectUser] -<== Columns: id, name, sex, degree, birthdaty 2013-12-27 13:16:56,436 TRACE [mapperNS.user.selectUser] -<== Row: 1, wang, 1, 1.00, 1983-08-01 2013-12-27 13:16:56,437 DEBUG [mapperNS.user.selectUser] -<== Total: 1 2013-12-27 13:16:56,439 INFO [action.UserAction] -User [id=1, name=wang, sex=1, birthday=null]
还有个问题记录一下
log4j:WARN No appenders could be found for logger (org.apache.ibatis.logging.LogFactory).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
这种情况下没有打印出日志, 说明应用并没有对log4j进行初始化. 解决方法是要在应用启动时就进行
// 这里的路径根目录是指应用的根目录,而不是classes目录
PropertyConfigurator.configure("bin/conf/log4j.properties");
mybatis下使用log4j打印sql语句和执行结果
标签:日志 res int 应用 debug style append 文档 tps