Skip to content

Commit 8a7144b

Browse files
committed
Document how to log @⁠Sql scripts and statements
Closes gh-31589
1 parent 6c3a3dc commit 8a7144b

File tree

2 files changed

+14
-0
lines changed
  • framework-docs/modules/ROOT/pages/testing/testcontext-framework
  • spring-test/src/main/java/org/springframework/test/context/jdbc

2 files changed

+14
-0
lines changed

framework-docs/modules/ROOT/pages/testing/testcontext-framework/executing-sql.adoc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,15 @@ script, depending on where `@Sql` is declared. If a default cannot be detected,
183183
defined in the class `com.example.MyTest`, the corresponding default script is
184184
`classpath:com/example/MyTest.testMethod.sql`.
185185

186+
[[testcontext-executing-sql-declaratively-logging]]
187+
=== Logging SQL Scripts and Statements
188+
189+
If you want to see which SQL scripts are being executed, set the
190+
`org.springframework.test.context.jdbc` logging category to `DEBUG`.
191+
192+
If you want to see which SQL statements are being executed, set the
193+
`org.springframework.jdbc.datasource.init` logging category to `DEBUG`.
194+
186195
[[testcontext-executing-sql-declaratively-multiple-annotations]]
187196
=== Declaring Multiple `@Sql` Sets
188197

spring-test/src/main/java/org/springframework/test/context/jdbc/Sql.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@
6060
* for details. This annotation may also be used as a <em>meta-annotation</em> to
6161
* create custom <em>composed annotations</em> with attribute overrides.
6262
*
63+
* <p>If you want to see which SQL scripts are being executed, set the
64+
* {@code org.springframework.test.context.jdbc} logging category to {@code DEBUG}.
65+
* If you want to see which SQL statements are being executed, set the
66+
* {@code org.springframework.jdbc.datasource.init} logging category to {@code DEBUG}.
67+
*
6368
* <p>Use of this annotation requires the {@code spring-jdbc} and {@code spring-tx}
6469
* modules as well as their transitive dependencies to be present on the classpath.
6570
*

0 commit comments

Comments
 (0)