XD-DENG commented on a change in pull request #6644: [AIRFLOW-6047] Simplify 
the logging configuration template
URL: https://github.com/apache/airflow/pull/6644#discussion_r350782170
 
 

 ##########
 File path: airflow/config_templates/airflow_local_settings.py
 ##########
 @@ -191,32 +215,6 @@
             'json_format': ELASTICSEARCH_JSON_FORMAT,
             'json_fields': ELASTICSEARCH_JSON_FIELDS
         },
-    },
-}
-
-REMOTE_LOGGING = conf.getboolean('core', 'remote_logging')
-
-# Only update the handlers and loggers when CONFIG_PROCESSOR_MANAGER_LOGGER is 
set.
-# This is to avoid exceptions when initializing RotatingFileHandler multiple 
times
-# in multiple processes.
-if os.environ.get('CONFIG_PROCESSOR_MANAGER_LOGGER') == 'True':
-    DEFAULT_LOGGING_CONFIG['handlers'] \
-        .update(DEFAULT_DAG_PARSING_LOGGING_CONFIG['handlers'])
-    DEFAULT_LOGGING_CONFIG['loggers'] \
-        .update(DEFAULT_DAG_PARSING_LOGGING_CONFIG['loggers'])
-
-    # Manually create log directory for processor_manager handler as 
RotatingFileHandler
-    # will only create file but not the directory.
-    processor_manager_handler_config = 
DEFAULT_DAG_PARSING_LOGGING_CONFIG['handlers'][
-        'processor_manager']
-    directory = os.path.dirname(processor_manager_handler_config['filename'])
-    mkdirs(directory, 0o755)
+    }
 
-if REMOTE_LOGGING and REMOTE_BASE_LOG_FOLDER.startswith('s3://'):
-    DEFAULT_LOGGING_CONFIG['handlers'].update(REMOTE_HANDLERS['s3'])
-elif REMOTE_LOGGING and REMOTE_BASE_LOG_FOLDER.startswith('gs://'):
-    DEFAULT_LOGGING_CONFIG['handlers'].update(REMOTE_HANDLERS['gcs'])
-elif REMOTE_LOGGING and REMOTE_BASE_LOG_FOLDER.startswith('wasb'):
-    DEFAULT_LOGGING_CONFIG['handlers'].update(REMOTE_HANDLERS['wasb'])
-elif REMOTE_LOGGING and ELASTICSEARCH_HOST:
-    DEFAULT_LOGGING_CONFIG['handlers'].update(REMOTE_HANDLERS['elasticsearch'])
+    DEFAULT_LOGGING_CONFIG['handlers'].update(ELASTIC_REMOTE_HANDLERS)
 
 Review comment:
   A quite minor thing and no difference in terms of logic: but why not we 
write in the way below
   ```python
   if REMOTE_LOGGING:
       if REMOTE_BASE_LOG_FOLDER.startswith('s3://'):
           ...
       elif REMOTE_BASE_LOG_FOLDER.startswith('gs://'):
           ...
       ...
       else:
           raise AirflowException("...")
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to