Logging SQL Queries in Spring Boot

Опубликовано: 10 Январь 2025
на канале: raksrahul
880
18

:::::::::::::::::::::::::::::::::::::::::::: Problem :::::::::::::::::::::::::::::::::::::::::::::
Using Spring JDBC and not sure how to see SQL Queries ?
How to see what query the Spring JDBCTemplate is actually executing ?
How to see the params of the JDBCTemplate in the query ?
How to see the Datasource that is used by the code ?


:::::::::::::::::::::::::::::::::::::::::::: Solution :::::::::::::::::::::::::::::::::::::::::::::
You just need to Log all of the above in your log files.

:::::::::::::::::::::::::::::::::::::::::::: How ? :::::::::::::::::::::::::::::::::::::::::::::
There are multiple methods to log the datasource configuration, sql queries with its params.
In this video, I have demostrated some of the easy methods one can use to log all of these info in there log file.

:: Index ::
00:00 - Intro
00:08 - Demo Application
00:48 - Problem
01:16 - Logging using spring jdbc package
02:09 - Print query params
03:07 - Using Logging Group
04:09 - Using Proxy(P6Spy) libraries
07:35 - Using auto configuration starter

Useful Links :
p6spy : https://github.com/p6spy/p6spy
spring-boot-datasource-decorator : https://github.com/gavlyukovskiy/spri...

Follow us on :
Facebook :   / raksrahul-100219708647780  
Instagram :   / raksrahul_ig  

#raksrahul #spring #logging #jdbc #java