diff --git a/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateOrmConfigPersistenceUnit.java b/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateOrmConfigPersistenceUnit.java
index e4b11ac28ec9c..3e7b323079a43 100644
--- a/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateOrmConfigPersistenceUnit.java
+++ b/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateOrmConfigPersistenceUnit.java
@@ -366,34 +366,6 @@ public boolean isAnyPropertySet() {
}
}
- @ConfigGroup
- public static class HibernateOrmConfigPersistenceUnitLog {
-
- /**
- * Show SQL logs and format them nicely.
- *
- * Setting it to true is obviously not recommended in production.
- */
- @ConfigItem
- public boolean sql;
-
- /**
- * Format the SQL logs if SQL log is enabled
- */
- @ConfigItem(defaultValue = "true")
- public boolean formatSql;
-
- /**
- * Whether JDBC warnings should be collected and logged.
- */
- @ConfigItem(defaultValueDocumentation = "depends on dialect")
- public Optional jdbcWarnings;
-
- public boolean isAnyPropertySet() {
- return sql || !formatSql || jdbcWarnings.isPresent();
- }
- }
-
@ConfigGroup
public static class HibernateOrmConfigPersistenceUnitCache {
/**
diff --git a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/FastBootHibernatePersistenceProvider.java b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/FastBootHibernatePersistenceProvider.java
index 12562f20b16ec..533e342981f09 100644
--- a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/FastBootHibernatePersistenceProvider.java
+++ b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/FastBootHibernatePersistenceProvider.java
@@ -372,6 +372,11 @@ private static void injectRuntimeConfiguration(String persistenceUnitName,
runtimeSettingsBuilder.put(AvailableSettings.LOG_JDBC_WARNINGS,
persistenceUnitConfig.log.jdbcWarnings.get().toString());
}
+
+ if (persistenceUnitConfig.log.queriesSlowerThanMs.isPresent()) {
+ runtimeSettingsBuilder.put(AvailableSettings.LOG_SLOW_QUERY,
+ persistenceUnitConfig.log.queriesSlowerThanMs.get());
+ }
}
}
diff --git a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/HibernateOrmRuntimeConfigPersistenceUnit.java b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/HibernateOrmRuntimeConfigPersistenceUnit.java
index d16fb2304d5f2..6f0c9cc49a13a 100644
--- a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/HibernateOrmRuntimeConfigPersistenceUnit.java
+++ b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/HibernateOrmRuntimeConfigPersistenceUnit.java
@@ -149,8 +149,14 @@ public static class HibernateOrmConfigPersistenceUnitLog {
@ConfigItem(defaultValueDocumentation = "depends on dialect")
public Optional jdbcWarnings = Optional.empty();
+ /**
+ * If set, Hibernate will log queries that took more than specified number of milliseconds to execute.
+ */
+ @ConfigItem
+ public Optional queriesSlowerThanMs;
+
public boolean isAnyPropertySet() {
- return sql || !formatSql || jdbcWarnings.isPresent();
+ return sql || !formatSql || jdbcWarnings.isPresent() || queriesSlowerThanMs.isPresent();
}
}