Repository: incubator-airflow Updated Branches: refs/heads/master 7ece95686 -> 956699fe6
[AIRFLOW-1602] LoggingMixin in DAG class Within the DAG class we want to use the LoggingMixer for more transparent logger instead of creating a new anonymous logger Closes #2602 from Fokko/AIRFLOW-1602-use- loggingmixin-in-dag-class Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/956699fe Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/956699fe Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/956699fe Branch: refs/heads/master Commit: 956699fe6840ec3a0623d58322fc0491373f9536 Parents: 7ece956 Author: Fokko Driesprong <[email protected]> Authored: Wed Sep 13 12:16:35 2017 +0200 Committer: Bolke de Bruin <[email protected]> Committed: Wed Sep 13 12:16:35 2017 +0200 ---------------------------------------------------------------------- airflow/models.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/956699fe/airflow/models.py ---------------------------------------------------------------------- diff --git a/airflow/models.py b/airflow/models.py index 39e65e8..7dc51d1 100755 --- a/airflow/models.py +++ b/airflow/models.py @@ -2746,7 +2746,7 @@ class DagModel(Base): @functools.total_ordering -class DAG(BaseDag): +class DAG(BaseDag, LoggingMixin): """ A dag (directed acyclic graph) is a collection of tasks with directional dependencies. A dag also has a schedule, a start end an end date @@ -3522,8 +3522,7 @@ class DAG(BaseDag): d['pickle_len'] = len(pickled) d['pickling_duration'] = "{}".format(datetime.now() - dttm) except Exception as e: - log = LoggingMixin().logger - log.debug(e) + self.logger.debug(e) d['is_picklable'] = False d['stacktrace'] = traceback.format_exc() return d @@ -3756,8 +3755,7 @@ class DAG(BaseDag): DagModel).filter(DagModel.dag_id == dag.dag_id).first() if not orm_dag: orm_dag = DagModel(dag_id=dag.dag_id) - log = LoggingMixin().logger - log.info("Creating ORM DAG for %s", dag.dag_id) + dag.logger.info("Creating ORM DAG for %s", dag.dag_id) orm_dag.fileloc = dag.fileloc orm_dag.is_subdag = dag.is_subdag orm_dag.owners = owner
