Hibernate cannot log the SQL and its parameters in the same line like you want . The logging provided by the Hibernate (by setting log4j.logger.org.hibernate.SQL=debug
and log4j.logger.org.hibernate.type=trace
in the log4j configuration) can only log the SQL and the parameters in the different lines likes this :
insert
intoAddress(address1, address2, city, province)
values
(?,?,?,?)
binding parameter [1]as[VARCHAR]- xxxxxx
binding parameter [2]as[VARCHAR]- xxxxxx
binding parameter [3]as[VARCHAR]- xxxx
You have to use JDBC proxy driver if you want to log the SQL with the parameters in the same line. I have tried log4jdbc and it can do it ,and it also can log the time spent by every SQL statement and log the lines in the code that cause the SQL statements .
相关推荐
对于hibernate 的日志配置,只要把下载下来的文件拷贝到src目录下即可运行,日志中包括了对hibernate的日志的注释可以根据自己的不同需求更改日志配置信息
搭建struts hibernate log4j spring(好东西)
springmvc5+hibernate5+junit4+log4j2整合实例 包含 代码实例 数据库建表sql 运行环境 myeclipes2015 jdk 1.8 tomcat 8.0
NULL 博文链接:https://elfasd.iteye.com/blog/1770847
集成 struts2 hibernate spring log4j tomcat mysql 的一个简单项目 在MyEclipse8.5 tomcat 下运行成功
hibernate-distribution-3.3.2.GA-dist.zip 下载地址:http://sourceforge.net/projects/hibernate/files/hibernate3/3.3.2.GA/ 搭建hibernate的相关Jar包,可以帮助初学者。 slf4j-log4j12-1.6.1.jar swarmcache-...
Hibernate Log4j Appender是一个Log4j附加程序,可使用hibernate记录到数据库。
hibernate3.3.2+commons-lang2.3+slf4j1.5.8+log4j1.2.16数据库的驱动请直接去自己的数据库的安装包中找到即可
Hibernate+log4j驱动包 Hibernate+log4j驱动包
例子 博文链接:https://log-cd.iteye.com/blog/562054
Struts_Spring_Hibernate_Log4j_Validator实例演示 完全组建
hibernate中配置文件,log4j-1.2.16.jar+slf4j-log4j12-1.5.2.jar,需要的童鞋赶紧的下载吧,直接解压即可。
hibernate框架整合log4j所需jar包,具体内容请见:https://blog.csdn.net/ScongHW/article/details/82850036
里面的包蛮全的 而且没有什么冲突 是我自己项目过程中积累下来的 可以放心使用
springmvc spring3 hibernate4 log4j 完整的注解配置 spring切面自动打日志等,需要自己建一个小表 可运行 并且已经将bootstrap集成进去.
commons-logging-1.1.1.jar,dom4j-1.6.1.jar,ehcache-1.5.0.jar,hibernate3.jar,hibernate-jpa-2.0-api-1.0.0.Final.jar,javassist-3.12.0.GA.jar,jta-1.1.jar,slf4j-api-1.6.1.jar,slf4j-log4j12-1.6.1.jar...
ssh2 spring hibernate struts2 log4j ant
hibernate3.2+mysql+log4j,包含这些jar就ok了
hibernate3.3.1接口实现包 slf4j-log4j12-1.5.2
Hibernate中使用slf4j技术,即简单日志门面(Simple Logging Facade for Java),它服务于各种各样的日志系统,用于整合其他日志系统。此资源就是整合log4j的日志。