이벤트와 로그

이벤트와 로그 (Events and logs)

dbt가 실행되면서 생성하는 이벤트를 보는 가장 흔한 방법은 로그 메시지예요. 터미널(stdout)과 디버그 로그 파일(logs/dbt.log) 두 곳에 실시간으로 기록됩니다.

출처: 문서

본문

dbt가 실행되는 동안 이벤트를 생성해요. 이벤트를 보는 가장 일반적인 방법은 로그 메시지로, 두 곳에 실시간으로 기록돼요:

  • 커맨드라인 터미널(stdout) — dbt 실행 중 인터랙티브한 피드백 제공.
  • 디버그 로그 파일(logs/dbt.log) — 오류 발생 시 상세한 디버깅 지원. 이 파일의 텍스트 형식 로그 메시지에는 모든 DEBUG 레벨 이벤트와 로그 레벨, 스레드 이름 같은 컨텍스트 정보가 포함돼요. 파일 위치는 log-path 플래그로 설정할 수 있어요.

CLI

21:35:48  6 of 7 OK created view model dbt_testing.name_list......................... [CREATE VIEW in 0.17s]

logs/dbt.log

============================== 21:21:15.272780 | 48cef052-3819-4550-a83a-4a648aef5a31 ==============================
21:21:15.272780 [info ] [MainThread]: Running with dbt=1.5.0-b5
21:21:15.273802 [debug] [MainThread]: running dbt with arguments {'printer_width': '80', 'indirect_selection': 'eager', 'log_cache_events': 'False', 'write_json': 'True', 'partial_parse': 'True', 'cache_selected_only': 'False', 'warn_error': 'None', 'fail_fast': 'False', 'debug': 'False', 'log_path': '/Users/jerco/dev/scratch/testy/logs', 'profiles_dir': '/Users/jerco/.dbt', 'version_check': 'False', 'use_colors': 'False', 'use_experimental_parser': 'False', 'no_print': 'None', 'quiet': 'False', 'log_format': 'default', 'static_parser': 'True', 'introspect': 'True', 'warn_error_options': 'WarnErrorOptions(include=[], exclude=[])', 'target_path': 'None', 'send_anonymous_usage_stats': 'True'}
21:21:16.190990 [debug] [MainThread]: Partial parsing enabled: 0 files deleted, 0 files added, 0 files changed.
21:21:16.191404 [debug] [MainThread]: Partial parsing enabled, no changes found, skipping parsing
21:21:16.207330 [info ] [MainThread]: Found 2 models, 0 tests, 0 snapshots, 1 analysis, 535 macros, 0 operations, 1 seed file, 0 sources, 0 exposures, 0 metrics, 0 groups

구조화된 로깅 (Structured logging)

(dbt v2.0 이상에 적용)

dbt v2는 dbt v1의 JSON 이벤트 로그 대신 OpenTelemetry 규약에 따라 구조화된 실행 텔레메트리를 출력해요. 로컬에서 보려면 --log-format otel을 쓰거나 dbt v2 텔레메트리와 관찰성의 옵션을 사용해요. dbt platform에서는 dbt v2 작업 실행에서 OTel 로그를 다운로드할 수 있어요.

--log-format, --log-level 및 관련 CLI 구성은 Logs를 참고하세요.

Python 인터페이스 (dbt v2.0 이상에 적용) dbt v2는 dbt v1의 Python 이벤트 인터페이스를 공유하지 않아요. 현재 Rust 바인딩으로 프로그래매틱 호출을 위한 Python API를 개발 중이에요.

더 알아보기 (Learn more)

  • Logs — 로그 관련 전역 구성 (log-path, log-format, log-level 등)
  • Debug errors — 오류 디버깅 가이드
  • OpenTelemetry — 구조화된 로깅 표준