title: Log messages for DAG import errors in Airflow 2.x
body: <p>I'm running Apache Airflow 2.x locally, using the Docker Compose file that is provided in <a href="https://airflow.apache.org/docs/apache-airflow/stable/start/docker.html" rel="nofollow noreferrer">the documentation</a>. In the <code>.\dags</code> directory on my local filesystem (which is mounted into the Airflow containers), I create a new Python script file, and implement the DAG using the TaskFlow API.</p>
  <p>The changed to my DAG are sometimes invalid. For example, maybe I have an <code>ImportError</code> due to an invalid module name, or a syntax error. When Airflow attempts to import the DAG, I cannot find any log messages, from the web server, scheduler, or worker, that would indicate a problem, or what the specific problem is.</p>
  <p>Instead, I have to read through my code line-by-line, and look for a problem. This problem is compounded by the fact that my local Python environment on Windows 10, and the Python environment for Airflow, are different versions and have different Python packages installed. Hence, I cannot reliably use my local development environment to detect package import failures, because the packages I expect to be installed in the Airflow environment are different than the ones I have locally. Additionally, the version of Python I'm using to write code locally, and the Python version being used by Airflow, are not matched up.</p>
  <p>Thus, I am needing some kind of error logging to indicate that a DAG import failed.</p>
  <p><strong>Question</strong>: When a DAG fails to update / import, where are the logs to indicate if an import failure occurred, and what the exact error message was?</p>