To display SQL statements issued by Spring’s JdbcTemplate in a Spring Boot application, set its logger to DEBUG:
logging.level.org.springframework.jdbc.core.JdbcTemplate=DEBUG
Spring’s documented SQL-operation logger is org.springframework.jdbc.core.JdbcTemplate. Your logging backend and console appender must also allow DEBUG messages through.
Enable JdbcTemplate SQL logging in Spring Boot
Add the logger setting to the configuration file your application uses. Spring Boot supports the general form logging.level.<logger-name>=<level>; see the Spring Boot logging documentation.
Using application.properties
logging.level.org.springframework.jdbc.core.JdbcTemplate=DEBUG
Using application.yml
logging:
level:
org.springframework.jdbc.core.JdbcTemplate: DEBUG
The class-level setting limits the change to JdbcTemplate’s logger. To include other Spring JDBC log messages while troubleshooting, use the broader package logger instead:
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitches#1 Best Overall
logging.level.org.springframework.jdbc.core=DEBUG
The package setting can produce more output than the class-level setting. Choose one according to how much detail you need.
What appears in the console
The Spring Framework API documentation says that all SQL operations performed by JdbcTemplate are logged at DEBUG under the org.springframework.jdbc.core.JdbcTemplate category. The JdbcTemplate API documentation identifies that logger; the Spring JDBC reference describes SQL issued by the template as DEBUG output under its fully qualified class-name category.
Rank #2
Enabling that logger makes the framework’s SQL-operation messages available; it does not guarantee a single reconstructed SQL statement with every bound value substituted. If you see the SQL but not parameter values, that is not necessarily a configuration error: parameter-aware output requires a separately configured JDBC instrumentation tool.
Does the same setting work with NamedParameterJdbcTemplate?
Yes. Spring Boot can auto-configure both JdbcTemplate and NamedParameterJdbcTemplate when the required JDBC setup is present. NamedParameterJdbcTemplate uses a JdbcTemplate internally, so start with the same logger setting. See the Spring Boot SQL data-access documentation.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Rank #3
When built-in logging is not enough
If you need bound-parameter visibility, execution timing, connection details, or richer formatted records, use a JDBC instrumentation layer such as a datasource proxy or P6Spy, and configure that tool’s logging separately. These tools have their own setup and behavior, so consult documentation for the specific library and version you select. More detailed SQL traces can expose sensitive values; keep them scoped to development or controlled diagnostics.
Troubleshoot missing SQL output
- Check that the property key is exactly
logging.level.org.springframework.jdbc.core.JdbcTemplateand that its value isDEBUG. - Restart the application after changing the configuration, unless your deployment explicitly supports runtime configuration refresh.
- Confirm that the code path uses Spring’s
JdbcTemplateorNamedParameterJdbcTemplate, rather than another data-access stack. - Check the active logging backend and console appender. Spring’s logging bridge selects an implementation such as Log4j 2, SLF4J, or JUL according to what is present on the classpath; the backend or appender may still filter DEBUG records. See the Spring Framework logging overview.
- If the output lacks the details you need, add a JDBC instrumentation tool and follow its version-specific configuration documentation.
- After diagnosis, remove the setting or narrow SQL DEBUG logging to avoid unnecessary output and exposure of sensitive data.
JdbcTemplate logging is not the H2 web console
JdbcTemplate logging writes SQL-operation messages to the application’s logs. Spring Boot’s H2 web console is a separate browser-based database console intended for development, not a way to display JdbcTemplate statements in the application console. Do not enable the H2 web console in production; see the Spring Boot H2 web console documentation.
Quick Recap
Rank #4
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

