Despite enabling SQL statement display and formatting in application.properties, SQL statements are not being logged to the designated file.
In your configuration, you've specified:
spring.jpa.show-sql=true spring.jpa.properties.hibernate.format_sql=true
While these settings allow for console logging of SQL statements, they do not redirect them to a log file.
To log SQL statements to a file, add the following properties to your application.properties:
logging.level.org.hibernate.SQL=DEBUG logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
The above is the detailed content of Why Aren't My Spring Boot SQL Statements Being Logged to a File?. For more information, please follow other related articles on the PHP Chinese website!