用mybatis时log4j总是不记录sql语句
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.
Fri Nov 15 10:44:43 CST 2019 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
更可恶的是没有任何出错提示。
查了一下有没有log4j依赖,log4j.properties加载在资源文件没,log4j.properties里的
log4j.logger.com.abc.dao.IStudentDao=debug,console这个部分是不是接口的全限定性类名
统统都没毛病!
但是就是不记录
最后发现mapper.xml的namespace=""这里面的值不是接口的全限定类名,因为一开始我觉得namespace不影响mybatis.xml与mapper.xml联系,不影响mybatis的执行dao,所以就没注意namespace
原来namespace的值也会影响log4j的日志记录呀,,,
正确之后:
D:\java\jdk\bin\java -ea -Didea.test.cyclic.buffer.size=1048576 -javaagent:D:\BaiduNetdiskDownload\ideaIU-2017.3.6.win\lib\idea_rt.jar=52733:D:\BaiduNetdiskDownload\ideaIU-2017.3.6.win\bin -Dfile.encoding=UTF-8 -classpath D:\BaiduNetdiskDownload\ideaIU-2017.3.6.win\lib\idea_rt.jar;D:\BaiduNetdiskDownload\ideaIU-2017.3.6.win\plugins\junit\lib\junit-rt.jar;D:\BaiduNetdiskDownload\ideaIU-2017.3.6.win\plugins\junit\lib\junit5-rt.jar;D:\java\jdk\jre\lib\charsets.jar;D:\java\jdk\jre\lib\deploy.jar;D:\java\jdk\jre\lib\ext\access-bridge-64.jar;D:\java\jdk\jre\lib\ext\cldrdata.jar;D:\java\jdk\jre\lib\ext\dnsns.jar;D:\java\jdk\jre\lib\ext\jaccess.jar;D:\java\jdk\jre\lib\ext\jfxrt.jar;D:\java\jdk\jre\lib\ext\localedata.jar;D:\java\jdk\jre\lib\ext\nashorn.jar;D:\java\jdk\jre\lib\ext\sunec.jar;D:\java\jdk\jre\lib\ext\sunjce_provider.jar;D:\java\jdk\jre\lib\ext\sunmscapi.jar;D:\java\jdk\jre\lib\ext\sunpkcs11.jar;D:\java\jdk\jre\lib\ext\zipfs.jar;D:\java\jdk\jre\lib\javaws.jar;D:\java\jdk\jre\lib\jce.jar;D:\java\jdk\jre\lib\jfr.jar;D:\java\jdk\jre\lib\jfxswt.jar;D:\java\jdk\jre\lib\jsse.jar;D:\java\jdk\jre\lib\management-agent.jar;D:\java\jdk\jre\lib\plugin.jar;D:\java\jdk\jre\lib\resources.jar;D:\java\jdk\jre\lib\rt.jar;D:\搜狗高速下载\讲课代码\JavaEE\mybatis02\target\test-classes;D:\搜狗高速下载\讲课代码\JavaEE\mybatis02\target\classes;D:\maven\NewRepository\junit\junit\4.11\junit-4.11.jar;D:\maven\NewRepository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;D:\maven\NewRepository\org\mybatis\mybatis\3.4.6\mybatis-3.4.6.jar;D:\maven\NewRepository\mysql\mysql-connector-java\5.1.47\mysql-connector-java-5.1.47.jar;D:\maven\NewRepository\log4j\log4j\1.2.17\log4j-1.2.17.jar com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 -junit4 com.abc.AppTest,test08
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.
Fri Nov 15 10:44:43 CST 2019 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
[DEBUG] ==> Preparing: select * from student where name like '%' ? '%'
[DEBUG] ==> Parameters: 三(String)
[DEBUG] <== Total: 3
用mybatis时log4j总是不记录sql语句的更多相关文章
- MyBatis学习 之 三、动态SQL语句
目录(?)[-] 三动态SQL语句 selectKey 标签 if标签 if where 的条件判断 if set 的更新语句 if trim代替whereset标签 trim代替set choose ...
- 关于EF6的记录Sql语句 与 EntityFramework.Extend 的诟病
1.关于EF6的记录Sql语句,一个老生长谈的问题. 他生成的sql语句实在是烂,大家都这样说 2.EF6 更新删除不方便,没有批量操作.所以,有人出了EF6.Extend 大家用起来也很爽 基于以 ...
- MyBatis一次执行多条SQL语句
MyBatis一次执行多条SQL语句 有个常见的场景:删除用户的时候需要先删除用户的外键关联数据,否则会触发规则报错. 解决办法不外乎有三个:1.多条sql分批执行:2.存储过程或函数调用:3.sql ...
- Mybatis 系列9-强大的动态sql 语句
[Mybatis 系列10-结合源码解析mybatis 执行流程] [Mybatis 系列9-强大的动态sql 语句] [Mybatis 系列8-结合源码解析select.resultMap的用法] ...
- Mybatis 删除多条数据XML SQL语句删除
Mybatis 删除多条数据XML SQL语句删除 1.删除多条数据SQL写法 <delete id="deleteParamsByIds"> delete from ...
- mybatis源码-Mapper解析之SQL 语句节点解析(一条语句对应一个MappedStatement)
目录 一起学 mybatis 0 <sql> 节点解析 1 解析流程 2 节点解析 2.1 解析流程 2.2 <include> 节点的解析 2.3 Node.ELEMENT_ ...
- Mybatis学习(8)动态sql语句
Mybatis 的动态sql语句是基于OGNL表达式的.可以方便的在 sql 语句中实现某些逻辑. 总体说来mybatis 动态SQL 语句主要有以下几类: 1. if 语句 (简单的条件判断) 2. ...
- ORACLE百万记录SQL语句优化技巧
1.对查询进行优化,应尽量避免全表扫描,首先应考虑在 where 及 order by 涉及的列上建立索引. 2.应尽量避免在 where 子句中对字段进行 null 值判断,否则将导致引擎放弃使用索 ...
- MyBatis学习(二)、SQL语句映射文件(1)resultMap
二.SQL语句映射文件(1)resultMap SQL 映射XML 文件是所有sql语句放置的地方.需要定义一个workspace,一般定义为对应的接口类的路径.写好SQL语句映射文件后,需要在MyB ...
随机推荐
- [ZJOI2010]排列计数 题解
Description 称一个1,2,...,N的排列P1,P2...,Pn是Magic的,当且仅当2<=i<=N时,Pi>Pi/2. 计算1,2,...N的排列中有多少是Magic ...
- 14、java实现poi操作excel,包括读和写日期格式,并且设置字体样式
1.首先大家来看导出的结果 下边就是导出的代码了 protected void testExcel() throws IOException{ String path=getServletContex ...
- java-Eclipse中使用JDBC连接数据库及相关操作
准备工作:mysql-connector-java-5.1.6-bin.jar配置 package com.job; import java.sql.Connection; import java.s ...
- POJ 3468 A Simple Problem with Integers (分块)
Description You have \(N\) integers, \(A_1, A_2, ... , A_N\). You need to deal with two kinds of ope ...
- HCW 19 Team Round (ICPC format) H Houston, Are You There?(极角排序)
题目链接:http://codeforces.com/gym/102279/problem/H 大致题意: 你在一个定点,你有个长度为R的钩子,有n个东西在其他点处,问你能勾到的东西的数量是多少? 思 ...
- js模块化的历史
了解模块化开发的历史,可以帮助我们理解 模块化开发的形式是怎么样的,对我们深入学习模块化开发会有很大的帮助: 一.服务器端JS的模块化 nodeJS的出现 ------官网: http://nod ...
- 2018-9-30-dotnet-core-通过修改文件头的方式隐藏控制台窗口
title author date CreateTime categories dotnet core 通过修改文件头的方式隐藏控制台窗口 lindexi 2018-09-30 18:36:43 +0 ...
- rest framework之APIView
一.rest framework配置 1.安装rest framework 在django环境中安装rest-framework框架: (automatic) C:\Users\Administrat ...
- js实现截取字符串后几位
var strs ="wdsdabcdefages" strs.substring(obj.filename.lastIndexOf("a")+1,strs.l ...
- VS2017编译Qt x64
1.打开VS本机工具命令提示vcvars64.bat. 2.进入Qt源码目录 cd E:\qt-everywhere-opensource-src- mkdir qt-build && ...