Skip to content

feat: support structured logging#277

Open
adubovik wants to merge 5 commits into
developmentfrom
feat/structured-logging
Open

feat: support structured logging#277
adubovik wants to merge 5 commits into
developmentfrom
feat/structured-logging

Conversation

@adubovik

Copy link
Copy Markdown
Collaborator

Summary

Migrates to aidial-sdk 0.38.0 and switches to the SDK's built-in logging configuration (LogConfig / configure_root_logger), which adds support for structured JSON logging alongside the existing text format. The service's request-prefix log filter is preserved on top of the SDK-installed handler.

The way to enable the JSON logs:

DIAL_SDK_LOG_FORMAT=json
DIAL_SDK_JSON_LOG_FORMAT='{"level": "%(levelname)s", "time": "%(asctime)s", "logger": "%(name)s", "process": "%(process)d", "message": "%(message)s"}'

Where DIAL_SDK_JSON_LOG_FORMAT is optional with a reasonable default.
More details in the SDK logging doc.

This is analogous to epam/ai-dial-adapter-bedrock#466, which made the same change in the Bedrock adapter.

Test plan

  • poetry run nox -s lint passes
  • poetry run nox -s tests passes (134 passed)
  • Manually verified text and JSON log output, including the request-prefix filter, via a local script

Migrate to aidial-sdk 0.38.0, which provides configure_root_logger/
LogConfig for uniform log formatting and JSON structured logging
(DIAL_SDK_LOG_FORMAT=json), replacing the hand-rolled root logger
setup. The app's request-prefix log filter is preserved on top of
the SDK-installed handler.

Analogous to epam/ai-dial-adapter-bedrock#466

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@adubovik
adubovik requested a review from Allob as a code owner July 17, 2026 15:59
Comment thread aidial_analytics_realtime/utils/logging.py
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@adubovik
adubovik force-pushed the feat/structured-logging branch from 5957111 to 71fb561 Compare July 17, 2026 16:13
adubovik and others added 3 commits July 17, 2026 17:22
The custom text_format only reordered process/name vs. the SDK's own
default, so just let configure_root_logger() use its defaults.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Re-apply the custom text_format to configure_root_logger() so the
repo's original log field order is preserved instead of switching to
the SDK's default order.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants