Skip to content

fix: enable JSON logging via configuration and add regression test - #19037

Merged
Sameerlite merged 1 commit into
BerriAI:mainfrom
Jetemple:json-log-fix
Jan 14, 2026
Merged

Sameerlite merged 1 commit into
BerriAI:mainfrom
Jetemple:json-log-fix

Conversation

@Jetemple

Copy link
Copy Markdown
Contributor

Relevant issues

Fixes json_logs: true in config file not enabling JSON logging when using CONFIG_FILE_PATH #19036

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem

CI (LiteLLM team)

CI status guideline:

  • 50-55 passing tests: main is stable with minor issues.
  • 45-49 passing tests: acceptable but needs attention
  • <= 40 passing tests: unstable; be careful with your merges and assess the risk.
  • Branch creation CI run
    Link:

  • CI run for the last commit
    Link:

  • Merge / cherry-pick CI run
    Links:

Type

🐛 Bug Fix

Changes

Bug: When using CONFIG_FILE_PATH environment variable (common in Helm/Kubernetes/Docker deployments), setting json_logs: true under litellm_settings in the config YAML file does not enable JSON logging.

Root cause: The CLI path (proxy_cli.py:672-682) correctly calls litellm._turn_on_json(), but the server startup path (proxy_server.py) only sets the attribute via setattr() without calling _turn_on_json() to reconfigure the logging handlers.

Fix: Added explicit handling for json_logs in ProxyConfig.load_config() that calls litellm._turn_on_json() when json_logs: true is set in the config.

Test: Added test_json_logs_calls_turn_on_json() regression test that verifies _turn_on_json() is called when loading a config with json_logs: true.

@vercel

vercel Bot commented Jan 13, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
litellm Ready Ready Preview, Comment Jan 13, 2026 4:43pm

@Sameerlite Sameerlite left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks!

@Sameerlite
Sameerlite merged commit 11cc8dc into BerriAI:main Jan 14, 2026
6 of 7 checks passed
fzowl pushed a commit to fzowl/litellm that referenced this pull request Jun 24, 2026
fix: enable JSON logging via configuration and add regression test

This branch was successfully deployed

1 active deployment
Preview — 9e08c220 Deployed Jan 13, 2026 by vercel[bot]
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