wolfier opened a new issue #16062:
URL: https://github.com/apache/airflow/issues/16062
**Apache Airflow version**: 2.1.0
**What happened**:
When I tried to call `logging.exception()`, the task instances fails.
```python
def func():
import logging
logging.exception("some error message")
with dag:
p = PythonOperator(
task_id='test',
python_callable=func,
)
```
<details>
<summary>task failure stack strace</summary>
```
Traceback (most recent call last):
File
"/usr/local/lib/python3.7/site-packages/airflow/models/taskinstance.py", line
1138, in _run_raw_task
self._prepare_and_execute_task_with_callbacks(context, task)
File
"/usr/local/lib/python3.7/site-packages/airflow/models/taskinstance.py", line
1311, in _prepare_and_execute_task_with_callbacks
result = self._execute_task(context, task_copy)
File
"/usr/local/lib/python3.7/site-packages/airflow/models/taskinstance.py", line
1341, in _execute_task
result = task_copy.execute(context=context)
File "/usr/local/lib/python3.7/site-packages/airflow/operators/python.py",
line 117, in execute
return_value = self.execute_callable()
File "/usr/local/lib/python3.7/site-packages/airflow/operators/python.py",
line 128, in execute_callable
return self.python_callable(*self.op_args, **self.op_kwargs)
File "/usr/local/airflow/src/__main__.py", line 12, in main
src.file_get_sftp(sftp_site_folder,dest_dir)
File "/usr/local/airflow/src/controller/source.py", line 102, in
file_get_sftp
logging.exception("Destination directory doesn't exist")
File "/usr/local/lib/python3.7/logging/__init__.py", line 1967, in
exception
error(msg, *args, exc_info=exc_info, **kwargs)
File "/usr/local/lib/python3.7/logging/__init__.py", line 1959, in error
root.error(msg, *args, **kwargs)
File "/usr/local/lib/python3.7/logging/__init__.py", line 1407, in error
self._log(ERROR, msg, args, **kwargs)
File "/usr/local/lib/python3.7/logging/__init__.py", line 1514, in _log
self.handle(record)
File "/usr/local/lib/python3.7/logging/__init__.py", line 1523, in handle
if (not self.disabled) and self.filter(record):
File "/usr/local/lib/python3.7/logging/__init__.py", line 751, in filter
result = f.filter(record)
File
"/usr/local/lib/python3.7/site-packages/airflow/utils/log/secrets_masker.py",
line 161, in filter
exc.args = (self.redact(v) for v in exc.args)
AttributeError: 'NoneType' object has no attribute 'args'
```
</details>
**What you expected to happen**:
I expect an exception message to be printed out.
**How to reproduce it**:
1. Create a simple DAG that calls `logging.exception()`
2. Execute the function
**Anything else we need to know**:
This issue was created for the PR (#16047).
--
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]