You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2021/07/20 08:52:26 UTC

[airflow] branch main updated: Adds more explanatory message when SecretsMasker is not configured (#17101)

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

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


The following commit(s) were added to refs/heads/main by this push:
     new 3a2e162  Adds more explanatory message when SecretsMasker is not configured (#17101)
3a2e162 is described below

commit 3a2e162387b5d73f1badda8fcf027fbc2caa0f28
Author: Jarek Potiuk <ja...@potiuk.com>
AuthorDate: Tue Jul 20 10:51:59 2021 +0200

    Adds more explanatory message when SecretsMasker is not configured (#17101)
    
    The secrets masker added in 2.1.0 introduced requirement that
    at least one SecretsMasker needs to be configured per task.
    
    However this introduced problems for several users who migrated
    from Airflow 1.10 and had their custom logging configuration
    done without first copying the base airflow configuration.
    
    The message about missing SecretsMasker was pretty cryptic for the
    users. This PR changes the message to be much more descriptive
    and pointing the user to the right place in documentation
    explaining how advanced logging configuration should be done.
---
 airflow/utils/log/secrets_masker.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/airflow/utils/log/secrets_masker.py b/airflow/utils/log/secrets_masker.py
index 537ee07..42fe576 100644
--- a/airflow/utils/log/secrets_masker.py
+++ b/airflow/utils/log/secrets_masker.py
@@ -102,7 +102,12 @@ def _secrets_masker() -> "SecretsMasker":
     for flt in logging.getLogger('airflow.task').filters:
         if isinstance(flt, SecretsMasker):
             return flt
-    raise RuntimeError("No SecretsMasker found!")
+    raise RuntimeError(
+        "Logging Configuration Error! No SecretsMasker found! If you have custom logging, please make "
+        "sure you configure it taking airflow configuration as a base as explained at "
+        "https://airflow.apache.org/docs/apache-airflow/stable/logging-monitoring/logging-tasks.html"
+        "#advanced-configuration"
+    )
 
 
 class SecretsMasker(logging.Filter):