我想将 SQL 语句记录到文件中。
我在 application.properties
中有以下属性:
spring.datasource.url=...
spring.datasource.username=user
spring.datasource.password=1234
spring.datasource.driver-class-name=net.sourceforge.jtds.jdbc.Driver
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true
security.ignored=true
security.basic.enabled=false
logging.level.org.springframework.web=INFO
logging.level.org.hibernate=INFO
logging.file=c:/temp/my-log/app.log
当我运行我的应用程序时,
cmd> mvn spring-boot:run
我可以在控制台中看到 SQL 语句,但它们没有出现在 app.log 中。该文件仅包含 Spring 的基本日志。
我应该怎么做才能在日志文件中看到 SQL 语句?
原文由 Oleg Pavliv 发布,翻译遵循 CC BY-SA 4.0 许可协议
尝试在您的属性文件中使用它: