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_r349981853
 
 

 ##########
 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:
   Do you think it's worthwhile to add a `else:` at the end? Inside it we can 
handle cases like user enters something wrong when they configure (e.g. user 
makes a typo in REMOTE_BASE_LOG_FOLDER and it starts with something like upper 
case "S3:" or "hs://")

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to