You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "amoghrajesh (via GitHub)" <gi...@apache.org> on 2025/05/27 04:24:21 UTC

Re: [PR] Separate configurations for colorized and json logs in Task SDK / Celery Executor [airflow]

amoghrajesh commented on code in PR #51082:
URL: https://github.com/apache/airflow/pull/51082#discussion_r2108128344


##########
task-sdk/src/airflow/sdk/log.py:
##########
@@ -140,7 +140,7 @@ def emit(self, record: logging.LogRecord):
 
 
 @cache
-def logging_processors(enable_pretty_log: bool, mask_secrets: bool = True):
+def logging_processors(enable_pretty_log: bool, mask_secrets: bool = True, enable_colors: bool = True):

Review Comment:
   Can we just use the same name as the config? 
   https://airflow.apache.org/docs/apache-airflow/stable/configurations-ref.html#colored-console-log



##########
task-sdk/src/airflow/sdk/log.py:
##########
@@ -261,13 +274,24 @@ def configure_logging(
 
             log_level = conf.get("logging", "logging_level", fallback="INFO")
 
+    # If enable_colors is not explicitly set, read from configuration
+    if enable_colors is None:
+        if "airflow.configuration" in sys.modules:

Review Comment:
   +1 same qn, we should just be able to do:
   
   ```
               from airflow.configuration import conf
   
               enable_colors = conf.getboolean("logging", "colored_console_log", fallback=True)
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org