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

[airflow] 23/39: Adds more explanatory message when SecretsMasker is not configured (#17101)

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

jhtimmins pushed a commit to branch v2-1-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit aaa9a4b3ebece41c0c665d7200ce451d4b642833
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.
    
    (cherry picked from commit 3a2e162387b5d73f1badda8fcf027fbc2caa0f28)
---
 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 1e8ad16..0ce0424 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):