This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/master by this push:
     new 6d612ef  Allows to configure logging for third-party libraries (#9657)
6d612ef is described below

commit 6d612efc7e19fff01b0da98bc345320edde70237
Author: Kamil BreguĊ‚a <[email protected]>
AuthorDate: Wed Jul 22 08:52:00 2020 +0200

    Allows to configure logging for third-party libraries (#9657)
---
 airflow/config_templates/airflow_local_settings.py | 14 +++++++++-----
 airflow/config_templates/config.yml                |  8 ++++++++
 airflow/config_templates/default_airflow.cfg       |  5 +++++
 3 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/airflow/config_templates/airflow_local_settings.py 
b/airflow/config_templates/airflow_local_settings.py
index f927a4a..3d3a15d 100644
--- a/airflow/config_templates/airflow_local_settings.py
+++ b/airflow/config_templates/airflow_local_settings.py
@@ -100,11 +100,6 @@ DEFAULT_LOGGING_CONFIG: Dict[str, Any] = {
             'handler': ['console'],
             'level': FAB_LOG_LEVEL,
             'propagate': True,
-        },
-        'connexion': {
-            'handler': ['console'],
-            'level': LOG_LEVEL,
-            'propagate': True,
         }
     },
     'root': {
@@ -113,6 +108,15 @@ DEFAULT_LOGGING_CONFIG: Dict[str, Any] = {
     }
 }
 
+EXTRA_LOGGER_NAMES: str = conf.get('logging', 'EXTRA_LOGGER_NAMES', 
fallback=None)
+if EXTRA_LOGGER_NAMES:
+    new_loggers = {
+        logger_name.strip(): {
+            'handler': ['console'], 'level': LOG_LEVEL, 'propagate': True, }
+        for logger_name in EXTRA_LOGGER_NAMES.split(",")
+    }
+    DEFAULT_LOGGING_CONFIG['loggers'].update(new_loggers)
+
 DEFAULT_DAG_PARSING_LOGGING_CONFIG: Dict[str, Dict[str, Dict[str, Any]]] = {
     'handlers': {
         'processor_manager': {
diff --git a/airflow/config_templates/config.yml 
b/airflow/config_templates/config.yml
index 960dbf2..35fb156 100644
--- a/airflow/config_templates/config.yml
+++ b/airflow/config_templates/config.yml
@@ -526,6 +526,14 @@
       type: string
       example: ~
       default: "task"
+    - name: extra_loggers
+      description: |
+        A comma\-separated list of third-party logger names that will be 
configured to print messages to
+        consoles\.
+      version_added: ~
+      type: string
+      example: "connexion,sqlalchemy"
+      default: ""
 - name: secrets
   description: ~
   options:
diff --git a/airflow/config_templates/default_airflow.cfg 
b/airflow/config_templates/default_airflow.cfg
index bcbd49e..68b21cd 100644
--- a/airflow/config_templates/default_airflow.cfg
+++ b/airflow/config_templates/default_airflow.cfg
@@ -288,6 +288,11 @@ dag_processor_manager_log_location = 
{AIRFLOW_HOME}/logs/dag_processor_manager/d
 # Default to use task handler.
 task_log_reader = task
 
+# A comma\-separated list of third-party logger names that will be configured 
to print messages to
+# consoles\.
+# Example: extra_loggers = connexion,sqlalchemy
+extra_loggers =
+
 [secrets]
 # Full class name of secrets backend to enable (will precede env vars and 
metastore in search path)
 # Example: backend = 
airflow.providers.amazon.aws.secrets.systems_manager.SystemsManagerParameterStoreBackend

Reply via email to