Home >Java >javaTutorial >Why Aren't My SQL Statements Logging in Spring Boot?
Logging SQL Statements in Spring Boot
In Spring Boot, it is possible to log SQL statements to a file by configuring the corresponding settings. However, if you have followed the steps outlined in the question and still cannot observe SQL statements in the log file, it may be due to an incorrect configuration.
To address this issue, consider adjusting your properties file as suggested in the answer:
logging.level.org.hibernate.SQL=DEBUG logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
By setting logging.level.org.hibernate.SQL to DEBUG and logging.level.org.hibernate.type.descriptor.sql.BasicBinder to TRACE, you enable verbose logging for Hibernate-related activities, including SQL statements. This updated configuration should now direct SQL statements to your designated log file, allowing you to monitor database interactions more effectively.
The above is the detailed content of Why Aren't My SQL Statements Logging in Spring Boot?. For more information, please follow other related articles on the PHP Chinese website!