105 lines
14 KiB
Markdown
105 lines
14 KiB
Markdown
---
|
|
title: official-doc / MongoDB Java Sync Driver — Logging (Logger Names, Levels, maxDocumentLength)
|
|
source_type: official-doc
|
|
url: https://www.mongodb.com/docs/drivers/java/sync/current/logging-monitoring/logging/
|
|
archive_url:
|
|
related_branches: [feature-mongo-runtime-baseline-contract]
|
|
related_projects: []
|
|
tags: [official-doc, ca-skeleton, persistence, mongodb]
|
|
created: 2026-07-28
|
|
---
|
|
|
|
# official-doc / MongoDB Java Sync Driver — Logging (Logger Names, Levels, maxDocumentLength)
|
|
|
|
> Layer: `raw/` — 외부 자료(공식 문서 / 대기업 기술 블로그)의 **원문 발췌·출처 기록**.
|
|
> 본 템플릿은 `raw/official-docs/` 와 `raw/company-tech-blogs/` 두 폴더가 공유.
|
|
> 검증된 요약은 `/ingest` 후 `wiki/concepts/`에 `source-summary-template` 형식으로 별도 작성. 원본은 raw에 영구 보관.
|
|
|
|
## source_type 허용값
|
|
|
|
`source_type: official-doc` — MongoDB Java Sync Driver 공식 문서 (Logging and Monitoring 섹션).
|
|
|
|
> 참고: 앞선 dispatch 는 `https://www.mongodb.com/docs/languages/java/sync-driver/current/logging-monitoring/logging/` 로 시도해 404 였다. 본 문서는 `https://www.mongodb.com/docs/drivers/java/sync/current/logging-monitoring/logging/` (200 OK 확인) 를 근거로 한다.
|
|
|
|
## Parent / 활용 branch
|
|
|
|
| Branch | 이 자료가 정당화하는 결정 |
|
|
|---|---|
|
|
| [[raw/branch-notes/feature-mongo-runtime-baseline-contract]] | MongoDB 쿼리 filter·document 값이 로그로 새지 않게 억제한다는 결정(branch 본문 §엣지·실패·의존 표의 "쿼리 filter·document 값이 로그로 유출" 행이 이미 `D18`·`§구현 가이드 8` 로 전방 참조 중 — 본 자료는 그 D18 을 세울 근거) — 어느 logger(`org.mongodb.driver.protocol`/`org.mongodb.driver.protocol.command`)가 command 내용을 어느 레벨(DEBUG)로 남기는지, 로그 레벨을 logger 단위로 어떻게 조정하는지, document 길이를 얼마나(기본 1000자) 제한할 수 있는지의 공식 근거 |
|
|
|
|
## 출처
|
|
|
|
- 원본 URL: https://www.mongodb.com/docs/drivers/java/sync/current/logging-monitoring/logging/
|
|
- 아카이브 URL: (미제공)
|
|
- 저자 / 조직: MongoDB, Inc. (공식 Java Sync 드라이버 문서, Logging and Monitoring 섹션)
|
|
- 발행일: (문서 자체에 명시 없음 — 드라이버 버전별 롤링 업데이트되는 레퍼런스 페이지. 본문 예시 코드는 driver-core 5.9 API 링크를 가리킴)
|
|
- 마지막 확인일: 2026-07-28
|
|
|
|
## 왜 저장했는지
|
|
|
|
`feature-mongo-runtime-baseline-contract` branch가 "MongoDB 쿼리 filter·document 값이 로그로 새지 않게 억제한다"를 결정하는 데 필요한 (1) 드라이버 logger 이름 계층과 각 logger 의 담당 범위, (2) command 로거가 DEBUG 레벨에서 실제로 command/reply 문서 전체를 기록한다는 사실, (3) SLF4J 바인딩 설정으로 logger 이름 단위 레벨 조정이 가능하다는 사실, (4) `maxDocumentLength()` 로 로그 메시지의 문자 길이를 제한할 수 있다는(그러나 필드 마스킹은 아니라는) 사실을 공식 근거로 보관.
|
|
|
|
## 핵심 인용
|
|
|
|
> [§Logger Names] "org.mongodb.driver.protocol : Commands sent to and replies received from MongoDB deployments"
|
|
|
|
> [§Logger Names] "org.mongodb.driver.connection : Connections and connection pools"
|
|
|
|
> [§Connection Settings — Example 로그 출력] "12:14:55.861 [main] DEBUG org.mongodb.driver.protocol.command - Command "find" started on database <database> using a connection with driver-generated ID 3 and server-generated ID 3 to <MongoDB hostname>. The request ID is 5. Command: {"find": "<collection>", "filter": {}, "limit": 1, "singleBatch": true, "$db": "<database>", "lsid": {"id": {"$binary": {"base64": "<_id>", "subType": "04"}}}, "$readPreference": {"mode": "primaryPreferred"}}"
|
|
|
|
> [§Connection Settings] "Sets the maximum document length, in characters, of a single log message" — Default: `1000`
|
|
|
|
> [§Logger Names — Example - Names] "This example shows how to change the log level for a specific driver logger. The example sets the root logger to OFF and the org.mongodb.driver.connection logger to INFO. This will cause the application to only log messages related to connecting to a MongoDB instance." 설정 예: `<logger name="org.mongodb.driver.connection" level="INFO" additivity="true"/>`
|
|
|
|
## Claims Extracted
|
|
|
|
> 이 자료가 **직접 말하는 것만** claim 으로 분리한다. 내 프로젝트에 적용한 결론은 여기 쓰지 않는다.
|
|
|
|
| Claim ID | Claim | Evidence quote | Strength | Applies to | Does not prove |
|
|
|---|---|---|---|---|---|
|
|
| MONGO-JAVA-LOG-C1 | 드라이버는 로깅 이벤트를 조직하기 위해 이름 있는 logger 계층을 정의하며, `org.mongodb.driver.protocol` 은 "MongoDB 배포로 보낸 명령과 그로부터 받은 응답"을 담당한다 | [§Logger Names] "org.mongodb.driver.protocol : Commands sent to and replies received from MongoDB deployments" | `official-vendor-doc` | command/reply 내용을 다루는 logger 가 어느 것인지 식별(값 노출 억제 대상 지정의 근거) | `org.mongodb.driver.protocol.command`(하위 logger)가 실제로 어떤 필드를 기록하는지는 C3·C4 가 별도로 증명 |
|
|
| MONGO-JAVA-LOG-C2 | `org.mongodb.driver.connection` logger 는 "연결과 connection pool"을 담당하며 command 내용과는 별개 관심사다 | [§Logger Names] "org.mongodb.driver.connection : Connections and connection pools" | `official-vendor-doc` | connection 관련 로거와 command 관련 로거가 서로 다른 이름 공간이라는 것 — 하나를 억제해도 다른 하나는 별도로 다뤄야 함을 보여주는 근거 | connection logger 를 억제하는 것만으로 command 값 노출이 막힌다는 것(별개 logger 계층이므로 이 자료가 그런 인과를 증명하지 않음) |
|
|
| MONGO-JAVA-LOG-C3 | 실제 로그 예시에서 `org.mongodb.driver.protocol.command` logger 는 DEBUG 레벨로 command 시작/성공 이벤트를 기록한다 | [§Connection Settings 예시 로그] "12:14:55.861 [main] DEBUG org.mongodb.driver.protocol.command - Command \"find\" started on database <database> using a connection with driver-generated ID 3" | `official-vendor-doc` | command 로거가 DEBUG 레벨에서 활성 관측 가능하다는 사실 확인 | 이 레벨이 모든 배포·버전에서 고정 불변이라는 것(레벨 자체는 사용자가 SLF4J 설정으로 조정 가능 — C5 참조) |
|
|
| MONGO-JAVA-LOG-C4 | 그 DEBUG 로그 라인의 `Command:` 필드에는 command document 전체(예시에서는 `find` command 의 `filter` 키 포함)가 직렬화되어 그대로 남는다 | [§Connection Settings 예시 로그] "Command: {\"find\": \"<collection>\", \"filter\": {}, \"limit\": 1, \"singleBatch\": true, \"$db\": \"<database>\"" | `official-vendor-doc` | "`org.mongodb.driver.protocol.command`를 DEBUG 이상으로 열면 쿼리 filter 값이 그대로 로그에 남는다"는 결정의 직접 근거 | 이 예시의 `filter` 값이 `{}`(빈 값)이라 실제 업무 데이터가 담긴 filter 가 노출된 사례 자체는 아님 — 다만 command document 전체가 직렬화되어 로그 문자열에 포함되는 **메커니즘**은 이 인용이 직접 보여줌. 필드 단위로 선택적 마스킹/redact 되는지는 이 인용만으로 증명 안 됨(C5 의 truncation 과는 별개 메커니즘) |
|
|
| MONGO-JAVA-LOG-C5 | `LoggerSettings.maxDocumentLength()` 로 단일 로그 메시지의 document 최대 길이(문자 수)를 설정할 수 있으며 기본값은 `1000`이다 | [§Connection Settings] "Sets the maximum document length, in characters, of a single log message" + "Default: 1000" | `official-vendor-doc` | 로그에 남는 document/command 내용의 길이를 제한하는 공식 제어 수단이 존재한다는 것, 그리고 그 기본값 | 이 길이 제한이 민감한 필드를 선택적으로 마스킹(redact)한다는 것 — 이 옵션은 문자 수 기준 **truncation**이지 필드 단위 마스킹 기능이 아니며, 원문에 필드 마스킹 옵션은 존재하지 않는다(부재 확인, self-grep) |
|
|
| MONGO-JAVA-LOG-C6 | 로그 레벨은 logger 이름 단위로 조정 가능하며, SLF4J 바인딩 프레임워크(logback/log4j2) 설정에서 root logger 를 `OFF` 로 두고 특정 driver logger 만 원하는 레벨로 올리는 방식으로 노출 범위를 좁힐 수 있다 | [§Logger Names — Example - Names] "This example shows how to change the log level for a specific driver logger. The example sets the root logger to OFF and the org.mongodb.driver.connection logger to INFO." + `<logger name="org.mongodb.driver.connection" level="INFO" additivity="true"/>` | `official-vendor-doc` | logger 이름 단위 레벨 억제가 공식적으로 지원되는 설정 방식이라는 것 — "어느 logger 를 어느 레벨로 묶어야 값이 안 새는가"를 SLF4J 설정으로 구현할 수 있다는 메커니즘 근거 | 이 예시는 `org.mongodb.driver.connection` 을 대상으로 시연했을 뿐 `org.mongodb.driver.protocol`/`org.mongodb.driver.protocol.command` 에 동일 패턴을 적용한 예시 로그를 직접 보여주지는 않음(단, 로거 계층 원리는 동일 — §메모 참조) |
|
|
|
|
### Strength 허용값
|
|
|
|
- `official-standard` — RFC, 표준 사양, 언어/프로토콜 표준
|
|
- `official-vendor-doc` — Spring, Keycloak, AWS, Google, MongoDB 등 공식 벤더 문서
|
|
- `official-reference` — 공식 reference/API 문서
|
|
- `company-case-study` — 대기업/실무 기술 블로그의 특정 사례
|
|
- `engineering-blog` — 개인/팀 블로그의 엔지니어링 해설
|
|
- `tutorial` — 튜토리얼/가이드. 일반화 금지
|
|
- `needs-confirmation` — 원문만으로는 적용 판단 불가
|
|
|
|
## Usage Boundaries
|
|
|
|
- 이 자료가 직접 증명하는 것:
|
|
- `MONGO-JAVA-LOG-C1`~`C2`: 드라이버가 정의하는 9개 logger 이름(`org.mongodb.driver.authenticator`/`client`/`cluster`/`connection`/`connection.tls`/`operation`/`protocol`/`uri`/`management`) 각각의 담당 범위 — command/reply 내용은 `org.mongodb.driver.protocol`(하위 `org.mongodb.driver.protocol.command`) 소관, connection pool 은 `org.mongodb.driver.connection` 소관으로 서로 분리됨
|
|
- `MONGO-JAVA-LOG-C3`~`C4`: command 로거가 DEBUG 레벨에서 command document(filter 포함)를 그대로 직렬화해 로그에 남긴다는 것
|
|
- `MONGO-JAVA-LOG-C5`: `maxDocumentLength()`(기본 1000자)가 로그 메시지 길이를 제한하는 유일한 공식 옵션이며, 이것은 truncation 이지 필드 마스킹이 아니라는 것
|
|
- `MONGO-JAVA-LOG-C6`: SLF4J 바인딩 설정에서 root 를 OFF 로 두고 특정 driver logger 만 레벨을 올리는 방식이 공식 예시로 제공된다는 것
|
|
- 이 자료가 증명하지 않는 것:
|
|
- 필드 단위 마스킹/redact 기능의 존재 여부 — 원문에 그런 옵션이 전혀 등장하지 않는다(부재 확인이지 "없다"는 벤더의 명시적 부정 진술은 아님)
|
|
- `org.mongodb.driver.protocol`(부모)과 `org.mongodb.driver.protocol.command`(자식) 각각을 **개별적으로** OFF/INFO 로 나눠 조정했을 때의 정확한 상속 동작 예시 — 로거 계층 상속 원리("A logger inherits the properties of its ancestor logger")는 일반론으로 서술되나, protocol/protocol.command 조합에 대한 실측 예시 로그는 이 문서에 없음
|
|
- `org.mongodb.driver.protocol` logger 를 완전히 OFF 로 꺼도 command 관련 다른 경로(예: Command Monitoring 이벤트 리스너, `org.mongodb.driver.operation` 의 재시도 로그)로 filter 값이 별도로 새는지 여부 — 이 문서는 SLF4J 로거 채널만 다루고 Command Monitoring API(별도 기능)는 다루지 않음
|
|
- Reactive Streams/Async 드라이버 등 다른 MongoDB Java 드라이버 변형에서도 동일 logger 이름·동일 기본값이 적용되는지 — 이 문서는 Sync 드라이버 전용 페이지
|
|
- MongoDB 서버 측(`mongod`/`mongos`) 로그에 동일한 filter 값 노출 문제가 있는지 — 이 문서는 클라이언트(드라이버) 로깅만 다룸
|
|
- 내 프로젝트에 적용하려면 추가 확인이 필요한 것:
|
|
- ca-skeleton 이 실제로 SLF4J 바인딩(logback 등)을 어떤 레벨로 배포 환경별(dev/staging/prod)로 설정하는지 — 현재 mongo 모듈 설정 여부는 branch note §Audit 참조(연결 자체가 미설정 상태, `A1`)
|
|
- `org.mongodb.driver.protocol`(부모) 레벨을 낮추는 것과 `org.mongodb.driver.protocol.command`(자식)만 개별 지정하는 것 중 어느 쪽이 ca-skeleton 의 로깅 프레임워크(logback 등)에서 실제로 원하는 억제 범위를 만드는지 로컬 검증 필요
|
|
- `maxDocumentLength` 축소만으로 민감한 필드(예: 개인정보가 담긴 filter 값)의 앞부분 노출까지 막을 수 있는지 — truncation 은 길이만 제한하므로 앞쪽 N자 안에 민감값이 있으면 여전히 노출됨. 이 gap 은 D18 결정에서 "레벨 자체를 낮춘다"와 "길이만 줄인다"를 혼동하지 않도록 명시가 필요
|
|
|
|
## 메모
|
|
|
|
- 이 페이지는 React Server Component(Next.js) payload 형태로 서빙되며, WebFetch(AI 요약 도구)는 tab 선택형 UI(Logger 드롭다운) 뒤의 실제 본문을 가져오지 못했다(nav 구조만 반환) — `curl` 로 raw HTML 을 직접 받아 임베딩된 JSON payload 안의 텍스트를 수동 unescape 해서 검증했다. self-grep 은 이 unescape 된 텍스트 파일(`/tmp/source-fetch-1785227947.txt`) 기준.
|
|
- logger 이름 목록에 `org.mongodb.driver.protocol.command` 자체는 "Logger Names" 목록에 별도 항목으로 나열되지 않는다 — 목록에는 부모인 `org.mongodb.driver.protocol` 만 있고, `protocol.command` 는 예시 로그 출력에서만 등장한다. 즉 `protocol.command` 가 `protocol` 의 자식이라는 것은 문서 앞부분의 "logger 이름은 계층을 이룬다"는 일반 설명("grandparent.parent.child" 예시)과 실제 로그 라인의 이름 문자열로부터 **추론**한 것이며, "protocol.command 는 protocol 의 공식 자식 logger 목록에 있다"는 명시적 1:1 진술은 이 페이지에 없다 — 검증되지 않은 추론이므로 Claims Extracted 에는 포함하지 않았다.
|
|
- 추가로 봐야 할 동일 출처 페이지: `https://www.mongodb.com/docs/drivers/java/sync/current/logging-monitoring/monitoring/` (Command Monitoring API — SLF4J 로거와 별개 채널로 command 이벤트를 구독하는 수단일 가능성, D18 완결 시 확인 필요)
|
|
|
|
## 관련
|
|
|
|
- 같은 주제 다른 official-doc: [[raw/official-docs/mongodb-connection-string-options]] (연결 문자열 옵션 — 동일 branch 근거)
|
|
- 이 자료를 인용한 wiki 요약: `[[wiki/concepts/...]]` (생성 시)
|