Skip to content

Feat: Added support for switching to ECS conformant JSON logging. - #23

Merged
buddemat merged 4 commits into
mainfrom
slb/mbu
Aug 10, 2026
Merged

Feat: Added support for switching to ECS conformant JSON logging.#23
buddemat merged 4 commits into
mainfrom
slb/mbu

Conversation

@buddemat

@buddemat buddemat commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Goal: Make cadenzaanalytics logging configurable to emit Elastic Common Schema (ECS) JSON, suitable for container log aggregation, covering the library itself, dependent packages, and analytics extension code — with minimal burden on extension developers.

Changes:

  • moved loggin to new file src/cadenzaanalytics/logging_config.py
  • added CadenzaEcsFormatter as subclass of ecs_logging.StdlibFormatter and stamping every record with service.name/service.version
  • explicitly re-pointting gunicorn.error/gunicorn.access at the same handler
  • documentation and tests

Comment thread src/cadenzaanalytics/tests/test_logging_config.py
Comment thread src/cadenzaanalytics/logging_config.py Outdated
@DanDits

DanDits commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Looks fine, I like having the two options and an easy switch so local development is not affected. Looks like you tried to work around some gunicorn quirks at best effort. Do the mentioned non-json lines that might be logged bother a potential json-expecting log consumer?

@buddemat
buddemat merged commit 7f76f1e into main Aug 10, 2026
6 checks passed
@buddemat
buddemat deleted the slb/mbu branch August 11, 2026 06:48
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