-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Separate configurations for colorized and json logs in Task SDK / Celery Executor #51082
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Separate configurations for colorized and json logs in Task SDK / Celery Executor #51082
Conversation
…'logging_processors' and 'configure_logging' functions. This allows for customizable console output with or without colors based on user preference or configuration settings.
|
@highlyavailable would you be able to address review comments so we can target this for Airflow 3.0.2 whose RC cut is on Tuesday? |
|
Yes I will get it done this morning |
- Remove conditional imports, use direct \ - Rename parameter from \ to \ to match existing config - Remove unrelated formatting options (show_locals) from color logic - Update tests to reflect the changes
@amoghrajesh I believe my most recent commit addresses all of the feedback in this thread. |
|
@uranusjr does the PR address your review comments? |
amoghrajesh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One comment, more like a nit, can be addressed now or in a followup.
|
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions. |
…sk SDK / Celery Executor (#51082) * Enhance logging configuration by adding 'enable_colors' parameter to 'logging_processors' and 'configure_logging' functions. This allows for customizable console output with or without colors based on user preference or configuration settings. (cherry picked from commit e25351d) Co-authored-by: Peter Bryant <pwbryant1@gmail.com>
…sk SDK / Celery Executor (apache#51082) * Enhance logging configuration by adding 'enable_colors' parameter to 'logging_processors' and 'configure_logging' functions. This allows for customizable console output with or without colors based on user preference or configuration settings. (cherry picked from commit e25351d) Co-authored-by: Peter Bryant <pwbryant1@gmail.com>
…sk SDK / Celery Executor (#51082) (#51344) * Enhance logging configuration by adding 'enable_colors' parameter to 'logging_processors' and 'configure_logging' functions. This allows for customizable console output with or without colors based on user preference or configuration settings. (cherry picked from commit e25351d) Co-authored-by: Peter Bryant <pwbryant1@gmail.com>
…sk SDK / Celery Executor (#51082) (#51344) * Enhance logging configuration by adding 'enable_colors' parameter to 'logging_processors' and 'configure_logging' functions. This allows for customizable console output with or without colors based on user preference or configuration settings. (cherry picked from commit e25351d) Co-authored-by: Peter Bryant <pwbryant1@gmail.com>
…ery Executor (apache#51082) * Enhance logging configuration by adding 'enable_colors' parameter to 'logging_processors' and 'configure_logging' functions. This allows for customizable console output with or without colors based on user preference or configuration settings.
Fixes #50963
This PR separates the control of log format (console vs JSON) from log styling (colors and rich traces) in the Task SDK logging configuration. Previously, the single
enable_pretty_logboolean controlled both aspects, making it impossible to have console logs without colors and rich traces.Problem
Solution
configure_logging()- uses defaultenable_colors=None→ reads configlogging_processors(enable_pretty_log=True)- uses defaultenable_colors=TrueNew Behavior Matrix:
Testing
All new & existing tests are passing, as well as the pre-commit checks. I wrote some simple unit tests in the test SDK,
test_logging_processors_with_colors(): Verifies colored console renderertest_logging_processors_without_colors(): Verifies non-colored console renderertest_logging_processors_json_format(): Verifies JSON renderer unchangedtest_configure_logging_respects_colored_console_log_config(): Tests configuration readingtest_configure_logging_explicit_enable_colors(): Tests explicit parameter overridetest_configure_logging_no_airflow_config(): Tests fallback behaviorSince I am new to the project, I also wrote a short testing script (attached as a
.txt) and ran it in my local Breeze environment, here were the results:demo_test.txt