Skip to content

Conversation

@joshuastagner
Copy link
Contributor

Summary

  • Adds explicit stream: ext://sys.stderr to the console and debug handlers in logging.yml
  • Preserves the current default behavior (logs to stderr)
  • Enables users to redirect logs to stdout via environment variable override

Problem

The logging configuration override system (in configuration.py) only allows overriding keys that already exist in logging.yml. Since stream was not defined, users couldn't redirect logs via PREFECT_LOGGING_HANDLERS_CONSOLE_STREAM.

Solution

By adding the explicit stream key with the current default (ext://sys.stderr), users can now override it:

PREFECT_LOGGING_HANDLERS_CONSOLE_STREAM=ext://sys.stdout

This is particularly useful in containerized environments (e.g., Kubernetes) where stdout and stderr may be handled differently by log aggregation systems.

Test plan

  • Verify default behavior unchanged (logs still go to stderr)
  • Verify env var override works: PREFECT_LOGGING_HANDLERS_CONSOLE_STREAM=ext://sys.stdout

🤖 Generated with Claude Code

The logging configuration override system only allows overriding keys that
already exist in logging.yml. This adds explicit `stream: ext://sys.stderr`
to the console and debug handlers, preserving the current default behavior
while enabling users to redirect logs to stdout via environment variable:

PREFECT_LOGGING_HANDLERS_CONSOLE_STREAM=ext://sys.stdout

This is useful in containerized environments (e.g., Kubernetes) where
stdout and stderr may be handled differently by log aggregation systems.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Copy link
Collaborator

@zzstoatzz zzstoatzz left a comment

Choose a reason for hiding this comment

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

lgtm!

@zzstoatzz zzstoatzz merged commit 56693d4 into main Dec 18, 2025
10 checks passed
@zzstoatzz zzstoatzz deleted the logging-stream-env-override branch December 18, 2025 00:56
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.

3 participants