Skip to content

Commit

Permalink
Adds more explanatory message when SecretsMasker is not configured (#…
Browse files Browse the repository at this point in the history
…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 3a2e162)
  • Loading branch information
potiuk authored and jhtimmins committed Aug 13, 2021
1 parent f5ef0dd commit 4709c65
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion airflow/utils/log/secrets_masker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 4709c65

Please sign in to comment.