---
title: "Discussion on \"Spring Boot下如何记录SQL语句、SQL参数、慢SQL日志\" | Hashnode"
description: "Discussion on \"Spring Boot下如何记录SQL语句、SQL参数、慢SQL日志\". 在我们程序在访问数据库，出现bug或者性能问题的时候，我们希望把SQL语句以及参数都打印出来，以便于我们定位bug和性能问题。\n你可能会使用的方式\n通常情况下，以使用Spring Data JPA和Hibernate为例（别走开，方案是和数据库访问技术无关的，理论上Mybatis，JDBC都可以使用），我们在application.yaml 里配置使用：\nspring.jpa.show-sql: true\n\n但这样的设置只能在开发测试环境里设置，因为使用此属性等同于使用System.out.pr..."
url: "https://hashnode.com/posts/spring-boot-sql-param-slow-sql/634f50f3de4fac9838dcaa90"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Spring Boot下如何记录SQL语句、SQL参数、慢SQL日志](https://wisely.top/spring-boot-sql-param-slow-sql?utm_source=hashnode&utm_medium=feed)

在我们程序在访问数据库，出现bug或者性能问题的时候，我们希望把SQL语句以及参数都打印出来，以便于我们定位bug和性能问题。 你可能会使用的方式 通常情况下，以使用Spring Data JPA和Hibernate为例（别走开，方案是和数据库访问技术无关的，理论上Mybatis，JDBC都可以使用），我们在application.yaml 里配置使用： spring.jpa.show-sql: true 但这样的设置只能在开发测试环境里设置，因为使用此属性等同于使用System.out.pr...

Oct 19, 2022 · 2 min read · wisely.top  
Read the article

-   [#springboot](https://hashnode.com/tag/springboot)
-   [#spring-data-jpa](https://hashnode.com/tag/spring-data-jpa)
-   [#hibernate](https://hashnode.com/tag/hibernate)

## Written by

[yunfei wang](https://hashnode.com/@wiselyman)

@wiselyman · CN

  
[View profile](https://hashnode.com/@wiselyman)

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
