Browse Source

Document how to log @⁠Sql scripts and statements

Closes gh-31589
pull/30534/merge
Sam Brannen 11 months ago
parent
commit
8a7144ba42
  1. 9
      framework-docs/modules/ROOT/pages/testing/testcontext-framework/executing-sql.adoc
  2. 5
      spring-test/src/main/java/org/springframework/test/context/jdbc/Sql.java

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

@ -183,6 +183,15 @@ script, depending on where `@Sql` is declared. If a default cannot be detected, @@ -183,6 +183,15 @@ script, depending on where `@Sql` is declared. If a default cannot be detected,
defined in the class `com.example.MyTest`, the corresponding default script is
`classpath:com/example/MyTest.testMethod.sql`.
[[testcontext-executing-sql-declaratively-logging]]
=== Logging SQL Scripts and Statements
If you want to see which SQL scripts are being executed, set the
`org.springframework.test.context.jdbc` logging category to `DEBUG`.
If you want to see which SQL statements are being executed, set the
`org.springframework.jdbc.datasource.init` logging category to `DEBUG`.
[[testcontext-executing-sql-declaratively-multiple-annotations]]
=== Declaring Multiple `@Sql` Sets

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

@ -60,6 +60,11 @@ import org.springframework.core.annotation.AliasFor; @@ -60,6 +60,11 @@ import org.springframework.core.annotation.AliasFor;
* for details. This annotation may also be used as a <em>meta-annotation</em> to
* create custom <em>composed annotations</em> with attribute overrides.
*
* <p>If you want to see which SQL scripts are being executed, set the
* {@code org.springframework.test.context.jdbc} logging category to {@code DEBUG}.
* If you want to see which SQL statements are being executed, set the
* {@code org.springframework.jdbc.datasource.init} logging category to {@code DEBUG}.
*
* <p>Use of this annotation requires the {@code spring-jdbc} and {@code spring-tx}
* modules as well as their transitive dependencies to be present on the classpath.
*

Loading…
Cancel
Save