'Quarkus - Log sql send by jdbc, not between hibernate and jdbc

I am using quarkus 2.7.4.Final and quarkus-hibernate-orm with postgresql 12

I alwready log sql from Hibernate thanks to the following config (application.properties)

quarkus.datasource.db-kind = postgresql
quarkus.datasource.username = postgres
quarkus.datasource.password = root

quarkus.hibernate-orm.database.generation=none
quarkus.hibernate-orm.log.sql=true
quarkus.hibernate-orm.log.format-sql=false
quarkus.hibernate-orm.log.bind-parameters=true
quarkus.datasource.jdbc.url = jdbc:postgresql://localhost:5432/formationhibernatetest

quarkus.log.level=TRACE
quarkus.log.min-level=TRACE

I don't found on quarkus guides how can logs sql request by the jdbc driver. On other projects I have used P6SPY or datasource-proxy-spring-boot-starter (with springboot)

So, with quarkus is there a way to log the real sql request sent by the jdbc driver ?

Thanks for your help Have a nice day Nicolas



Solution 1:[1]

The easiest way is to log via Hibernate as you already did.

If you want to log at the JDBC level you can uses P6SPY, for this you need to configure your datasoure with the 'other' db-kind, configure the P6SPY driver and specify the Hibernate dialect as Hibernate will not be able to automatically detect it.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 loicmathieu