I tried activating the Slow Queries Log but there seems to be a problem with the SQL query printing. My application runs on WildFly 18.0.1, it seems like the problem is related. This is the output I get:
11:20:18,335 INFO [org.hibernate.SQL_SLOW] (default task-15) SlowQuery: 25327 milliseconds. SQL: 'org.jboss.jca.adapters.jdbc.jdk8.WrappedPreparedStatementJDK8@17ec12d7'
Hibernate 5.4.10, Amazon Corretto 11.0.5, Windows 10, SQL Server 10.50, JDBC Driver mssql 7.4.1.jre11