feat(logging): Add structured JSON logging support for console#1265
feat(logging): Add structured JSON logging support for console#1265
Conversation
- Update `JsonFormatter` in `core/logger.py` to include standard fields for cloud logging (severity, timestamp, logger). - Add robust handling for request body parsing in logs. - Configure `console_handler` to use `JsonFormatter` when `system.structured_log` config is enabled (via `YETI_SYSTEM_STRUCTURED_LOG` env var). - Defaults to text logging for backward compatibility. Fixes #1264 Co-authored-by: tomchop <1257972+tomchop@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
- Update `JsonFormatter` in `core/logger.py` to include standard fields for cloud logging (severity, timestamp, logger). - Add robust handling for request body parsing in logs. - Configure `console_handler` to use `JsonFormatter` when `system.structured_log` config is enabled (via `YETI_SYSTEM_STRUCTURED_LOG` env var). - Fix import sorting in `contrib/` files to satisfy Ruff linter. - Defaults to text logging for backward compatibility. Fixes #1264 Co-authored-by: tomchop <1257972+tomchop@users.noreply.github.com>
|
Instead of reading a value from the config file, can you base it on a |
I've updated the code to use the |
- Update `JsonFormatter` in `core/logger.py` to include standard fields for cloud logging (severity, timestamp, logger). - Add robust handling for request body parsing in logs. - Configure `console_handler` to use `JsonFormatter` when `K8S_RUNTIME` environment variable is set to "true". - Fix import sorting in `contrib/` files to satisfy Ruff linter. - Defaults to text logging for backward compatibility. Fixes #1264 Co-authored-by: tomchop <1257972+tomchop@users.noreply.github.com>
- Update `JsonFormatter` in `core/logger.py` to include standard fields for cloud logging (severity, timestamp, logger). - Add robust handling for request body parsing in logs. - Configure `console_handler` to use `JsonFormatter` when `YETI_K8S_RUNTIME` environment variable is set to "true". - Fix import sorting in `contrib/` files to satisfy Ruff linter. - Defaults to text logging for backward compatibility. Fixes #1264 Co-authored-by: tomchop <1257972+tomchop@users.noreply.github.com>
This PR updates the logging configuration to support structured JSON logging on the console, which is crucial for correct interpretation of logs by cloud services like Google Cloud Logging (stackdriver).
Changes:
JsonFormatterto includeseverity,timestamp(UTC ISO 8601), andloggerfields.JsonFormatterforconsole_handlerbased onsystem.structured_logconfiguration.PR created automatically by Jules for task 6267569848034666326 started by @tomchop