Log queries with parameters in Hibernate 5 and 6

For debugging purposes it is often useful to log hibernate generated queries in your application.

In a Spring Boot application up to 2.7 using Hibernate 5.x, this can be achieved using the following configuration.

# log SQL statements
logging.level.org.hibernate.SQL=debug
# log SQL binding parameters to get the actual values of a query parameter
logging.level.org.hibernate.type.descriptor.sql=trace

In Hibernate 6.x used e.g. in Spring Boot 3.0 / 3.1 the parameter for the parameter output has changed. In order to acchive the same result as above, the following configuration is required.

# log SQL statements
logging.level.org.hibernate.SQL=debug
# log SQL binding parameters to get the actual values of a query parameter
logging.level.org.hibernate.orm.jdbc.bind=trace

In summary: for parameter logging up to Hibernate 5 you have to configure “org.hibernate.type.descriptor.sql” and for Hibernate 6 you have to use “org.hibernate.orm.jdbc.bind”

PostgreSQL pg_upgradecluster

If the version of a PostgreSQL server changes, it is required to upgrade the version manually. This can e.g. happen, if you do a release upgrade of your Linux distribution. The below description explains how to use PostgreSQL pg_upgradecluster to upgrade PostgreSQL 9.6 from Debian Stretch (Debian 9) to PostgreSQL 11 of Debian Buster (Debian 10).

Continue reading “PostgreSQL pg_upgradecluster”