From 26e2dc2da521a503cca0cdb302555a3b6e8282e5 Mon Sep 17 00:00:00 2001 From: Gavin King Date: Tue, 8 Jul 2025 09:43:02 +0200 Subject: [PATCH] document log category org.hibernate.orm.jdbc.batch in Short Guide --- .../src/main/asciidoc/introduction/Configuration.adoc | 5 ++++- documentation/src/main/asciidoc/introduction/Tuning.adoc | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/documentation/src/main/asciidoc/introduction/Configuration.adoc b/documentation/src/main/asciidoc/introduction/Configuration.adoc index d1a5e1acf627..478d61e7e75d 100644 --- a/documentation/src/main/asciidoc/introduction/Configuration.adoc +++ b/documentation/src/main/asciidoc/introduction/Configuration.adoc @@ -490,7 +490,7 @@ These settings really help when troubleshooting the generated SQL statements. | `hibernate.highlight_sql` | If `true`, log SQL with syntax highlighting via ANSI escape codes |=== -Alternatively, you can enable debug-level logging for the category `org.hibernate.SQL` using your preferred SLF4J logging implementation. +Alternatively, you can enable ``DEBUG``-level logging for the category `org.hibernate.SQL` using your preferred SLF4J logging implementation. For example, if you're using Log4J 2 (as above in <>), add these lines to your `log4j2.properties` file: @@ -507,6 +507,9 @@ logger.jdbc-bind.level=trace logger.jdbc-extract.name=org.hibernate.orm.jdbc.extract logger.jdbc-extract.level=trace +# JDBC batching +logger.jdbc-batch.name=org.hibernate.orm.jdbc.batch +logger.jdbc-batch.level=trace ---- SQL logging respects the settings `hibernate.format_sql` and `hibernate.highlight_sql`, so we don't miss out on the pretty formatting and highlighting. diff --git a/documentation/src/main/asciidoc/introduction/Tuning.adoc b/documentation/src/main/asciidoc/introduction/Tuning.adoc index 6e5f7144b743..d5dede466acd 100644 --- a/documentation/src/main/asciidoc/introduction/Tuning.adoc +++ b/documentation/src/main/asciidoc/introduction/Tuning.adoc @@ -141,6 +141,8 @@ All we need to do is set a single property: | link:{doc-javadoc-url}/org/hibernate/cfg/BatchSettings.html#STATEMENT_BATCH_SIZE[`hibernate.jdbc.batch_size`] | Maximum batch size for SQL statement batching | `setJdbcBatchSize()` |=== +To confirm that statement batching is working, enable ``TRACE``-level logging for the category `org.hibernate.orm.jdbc.batch`. + That said, batching is rarely the most convenient or most efficient way to update or delete many rows at once. [TIP]