发表于2018-05-262019-01-01 作者 wind
需要设置 hibernate 的日志的实现,我这里用slf4j:
public static void main(String[] args) {
System.setProperty("jboss.logging.provider", "slf4j");
SpringApplicationBuilder builder = new SpringApplicationBuilder().web(true).sources(Application.class).profiles(
"web");
builder.run(args);
}
我用的是spring boot项目结构,所以在application.yml里面直接配置日志:
logging:
level:
root: info
org.hibernate.hql.internal.ast.HqlSqlWalker: error
org.hibernate.type.descriptor.sql.BasicBinder: trace
# org.hibernate.type.descriptor.sql.BasicExtractor: trace
org.hibernate.engine.spi.QueryParameters: trace
# org.hibernate.engine.query.spi.HQLQueryPlan: trace
cn.firegod: debug
这样在执行的时候,就会有类似下面这样的输出:
Hibernate: select courseenti0_.id as id1_15_0_, courseenti0_.create_by as create_b2_15_0_, courseenti0_.create_date as create_d3_15_0_, courseenti0_.del_flag as del_flag4_15_0_, courseenti0_.name as name5_15_0_, courseenti0_.remarks as remarks6_15_0_, courseenti0_.update_by as update_b7_15_0_, courseenti0_.update_date as update_d8_15_0_ from cdev_school_course courseenti0_ where courseenti0_.id=?
2018-05-26 13:40:40.523 TRACE 64785 --- [nio-9999-exec-2] o.h.type.descriptor.sql.BasicBinder : binding parameter [1] as [INTEGER] - [1]
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有