Enable Hibernate logging

前端 未结 5 1559
一生所求
一生所求 2020-12-03 03:04

I\'m trying to create a log of hibernate statements. I perform my sql statements using JPA where Hibernate 2.0 is the persistence provider (my application server is JBoss AS

5条回答
  •  时光说笑
    2020-12-03 03:47

    We have a tomcat-8.5 + restlet-2.3.4 + hibernate-4.2.0 + log4j-1.2.14 java 8 app running on AlpineLinux in docker.

    On adding these 2 lines to /usr/local/tomcat/webapps/ROOT/WEB-INF/classes/log4j.properties, I started seeing the HQL queries in the logs:

    ### log just the SQL
    log4j.logger.org.hibernate.SQL=debug
    
    ### log JDBC bind parameters ###
    log4j.logger.org.hibernate.type=debug
    

    However, the JDBC bind parameters are not being logged.

提交回复
热议问题