93 lines
5.8 KiB
Markdown
93 lines
5.8 KiB
Markdown
---
|
|
title: official-doc / P6Spy — Configuration & Usage (spy.properties, executionThreshold, parameter logging)
|
|
source_type: official-doc
|
|
url: https://p6spy.readthedocs.io/en/latest/configandusage.html
|
|
archive_url:
|
|
status: raw
|
|
confidence: high
|
|
tags: [backend, db, jdbc, proxy, slow-query, p6spy, observability]
|
|
related_branches: [feature-database-connection-pool-contract]
|
|
related_projects: []
|
|
created: 2026-06-09
|
|
last_reviewed: 2026-06-09
|
|
---
|
|
|
|
# P6Spy — Configuration & Usage
|
|
|
|
> Layer: `raw/` — 외부 자료(공식 문서)의 원문 발췌·출처 기록.
|
|
|
|
## Parent / 활용 branch
|
|
|
|
| Branch | 이 자료가 정당화하는 결정 |
|
|
|---|---|
|
|
| [[raw/branch-notes/feature-database-connection-pool-contract]] | P6Spy 슬로우 쿼리 탐지의 파라미터 노출 기본 동작 및 마스킹 가능성 근거 |
|
|
|
|
## 출처 / Source
|
|
|
|
- 원본 URL: https://p6spy.readthedocs.io/en/latest/configandusage.html
|
|
- 보조 URL: https://github.com/gavlyukovskiy/spring-boot-data-source-decorator
|
|
- 저자 / 조직: P6Spy project, gavlyukovskiy (Spring Boot 통합)
|
|
- 마지막 확인일: 2026-06-09
|
|
|
|
## 왜 저장했는지 / Why archived
|
|
|
|
`feature-database-connection-pool-contract` 브랜치에서 JDBC 프록시 기반 슬로우 쿼리 탐지 대안으로 P6Spy를 검토. 핵심 질문: (1) 기본 설정에서 파라미터 값이 로그에 출력되는가, (2) 파라미터 로깅을 완전히 억제할 수 있는가. 프로젝트 "SQL/파라미터 로그 금지" 하드 룰과의 호환성 평가.
|
|
|
|
## 핵심 인용 / Key quotes (verbatim)
|
|
|
|
> "executionThreshold=integer time (milliseconds)" — default: 0. "This logs only statements exceeding the specified duration."
|
|
|
|
— p6spy configandusage docs
|
|
|
|
> "the 'effective SQL string' displays 'the values of the Prepared Statement so you can see the effective SQL statement that is passed to the database.'"
|
|
|
|
— p6spy configandusage docs (파라미터 값 기본 출력 명시)
|
|
|
|
> "excludecategories — comma separated list of categories to exclude: error, info, batch, debug, statement, commit, rollback, result and resultset. Default: info,debug,result,resultset,batch"
|
|
|
|
— p6spy spy.properties reference
|
|
|
|
> "customLogMessageFormat — ... Omit parameter-revealing placeholders. Instead of %(sql) or %(sqlSingleLine), use %(effectiveSql) or construct a format excluding these fields to avoid showing actual parameter values."
|
|
|
|
— p6spy configandusage docs (parameter hiding approach)
|
|
|
|
> "No dedicated parameter masking feature exists."
|
|
|
|
— p6spy configandusage docs (implied by absence)
|
|
|
|
## Claims Extracted / 추출된 주장
|
|
|
|
| Claim ID | Claim (이 자료가 직접 말하는 것) | Evidence quote | Strength | Applies to | Does not prove |
|
|
|---|---|---|---|---|---|
|
|
| C1 | P6Spy 는 `executionThreshold` (ms 단위) 로 슬로우 쿼리 임계값을 설정하며, 기본값은 0 (모든 쿼리 로깅) 이다 | "executionThreshold=integer time (milliseconds)" | `official-vendor-doc` | P6Spy 3.x 모든 환경 | — |
|
|
| C2 | P6Spy 기본 설정에서 바인드 파라미터 값이 SQL 에 치환되어(effective SQL) 로그에 출력된다 | "values of the Prepared Statement so you can see the effective SQL statement that is passed to the database" | `official-vendor-doc` | P6Spy 3.x 모든 환경 | 파라미터가 `?` 플레이스홀더로 출력된다는 주장 반증 |
|
|
| C3 | P6Spy 에는 빌트인 파라미터 마스킹 기능이 없다 | "No dedicated parameter masking feature exists" (공식 문서에서 해당 기능 설명 부재) | `official-vendor-doc` | P6Spy 3.x | 커스텀 Appender 로 우회할 수 없다는 주장 반증 |
|
|
| C4 | `customLogMessageFormat` 으로 파라미터 값을 포함하는 placeholder 를 제외할 수 있으나, 이는 우회책이며 직접적 마스킹이 아니다 | "Omit parameter-revealing placeholders ... avoid showing actual parameter values" | `official-vendor-doc` | P6Spy 3.x + customLogMessageFormat 사용 환경 | 모든 파라미터를 안전하게 제거했음을 보장하지 않음 (format 설정 실수 시 노출 가능) |
|
|
| C5 | P6Spy 는 Spring Boot 통합을 공식 직접 지원하지 않고 third-party 라이브러리 (spring-boot-data-source-decorator) 를 경유한다 | "Spring Boot integration is handled through a separate project called 'spring-boot-data-source-decorator'" | `official-vendor-doc` | Spring Boot 환경 | — |
|
|
|
|
## Usage Boundaries / 적용 경계
|
|
|
|
- 이 자료가 직접 증명하는 것:
|
|
- `C1`: executionThreshold 로 슬로우 쿼리 임계값 설정 가능
|
|
- `C2`: 기본 설정에서 파라미터 값이 포함된 SQL이 로그에 출력됨
|
|
- `C3`: 빌트인 파라미터 마스킹 없음
|
|
- `C4`: customLogMessageFormat 로 파라미터 출력을 우회적으로 억제 가능하나 안전성 보장 없음
|
|
- 이 자료가 증명하지 않는 것:
|
|
- customLogMessageFormat 설정으로 파라미터 노출이 완전히 차단됨을 보장
|
|
- 운영 환경에서 설정 변경 누락 시 파라미터가 노출된다는 위험의 정도
|
|
- 내 프로젝트에 적용하려면 추가 확인이 필요한 것:
|
|
- `customLogMessageFormat` 을 통한 파라미터 제거가 슬로우 쿼리 탐지 로그에도 동일하게 적용되는지 확인
|
|
- P6Spy vs datasource-proxy 비교 시 파라미터 제어 안전성 (datasource-proxy ParameterTransformer 방식이 더 명시적일 수 있음)
|
|
|
|
## 메모 / Notes
|
|
|
|
- P6Spy 는 모든 JDBC 호출을 인터셉트하는 구조이므로 overhead 가 datasource-proxy 와 유사하게 높음
|
|
- `excludecategories` 로 statement 카테고리를 제외하면 쿼리 자체가 로깅되지 않아 슬로우 쿼리 탐지도 불가
|
|
- Spring Boot 통합이 third-party 의존적이라 버전 호환성 리스크 존재
|
|
|
|
## Related / 관련
|
|
|
|
- [[raw/official-docs/datasource-proxy-slow-query-official]]
|
|
- [[raw/official-docs/hibernate-slow-query-log-official]]
|
|
- 이 자료를 인용한 wiki 요약: (미생성)
|