Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 98E39200D43 for ; Tue, 21 Nov 2017 19:06:06 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 9770C160BFC; Tue, 21 Nov 2017 18:06:06 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id E53AB160BE3 for ; Tue, 21 Nov 2017 19:06:05 +0100 (CET) Received: (qmail 95683 invoked by uid 500); 21 Nov 2017 18:06:05 -0000 Mailing-List: contact dev-help@airflow.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@airflow.incubator.apache.org Delivered-To: mailing list dev@airflow.incubator.apache.org Received: (qmail 95671 invoked by uid 99); 21 Nov 2017 18:06:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Nov 2017 18:06:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id D8791180710 for ; Tue, 21 Nov 2017 18:06:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.629 X-Spam-Level: ** X-Spam-Status: No, score=2.629 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id EDm3Q-v83J5c for ; Tue, 21 Nov 2017 18:06:02 +0000 (UTC) Received: from mail-qk0-f180.google.com (mail-qk0-f180.google.com [209.85.220.180]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id BEFDB5FCF9 for ; Tue, 21 Nov 2017 18:06:01 +0000 (UTC) Received: by mail-qk0-f180.google.com with SMTP id w125so13263248qkb.6 for ; Tue, 21 Nov 2017 10:06:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=4yyWmWxog+JF7BDvAqE22VSacvk3Qma3mZ/4KzPQtvg=; b=sJzBUFwP/vgY6g6hFi46EJw+6ofBmPafUe1SqLlChuAxcnedO+7NSb4kCpghbOFALS bYipDfabqxeCxo9/vJ0HJoGiCLHxdnypkka+lSd+6Uk0GXC3dAa86afye4pUIyDDxZVb 3kxfjmpt/iqNDl/c800wJLpuKtkw1rtKuA4bNl8qLgojRmvba6+CHc7yWtp2fXOaadSe t2y/Zn35sADD3HrAzfMZqnns4ANG9krvmE4Wdj+tjBXI/iZAoIYpAFgKHtEMdJuZ6gSS iOOW5fCkuwv+i7Gv1tVyQnFTc75zPecuWZMqVGOxsVvgYUtxGQt7mfP4doiQIxIgs5gt qR/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=4yyWmWxog+JF7BDvAqE22VSacvk3Qma3mZ/4KzPQtvg=; b=hj9yzwZ3Hyv+gy6DGDd67lqaCY5/suoYr87Wpbwo3u1I5j4aS6dTi1GIGvoAPB0mlV LAPc+Z3eQuWOcKc02yyM+OJe9cGrm0zUkddM1xfcFJAf+Zlbkdxkyr2ww4McfP0609YV 0wv5y66JjEa/8ewb+oa3JN7DvkG4BTDLWJIxa5pa9lt9kmOPsK8pNX2vGefDgdKp6Hcn 6x7gMpzSQ7pNXcSykVnKCDWrnh4hDnL6urMrRfcOXMuK1eOhru5hILA5cX+DUQTnviqj SkmoVTYPa4ZQG2Jru1d4JPLY3Sw9PS/dFTnYVvCVgjH0PcFWPFjxw08PYEOrUlEPyuKf OdNA== X-Gm-Message-State: AJaThX6VCELUp0ro28Q/iJhEXU2+eQtn4SOHKXKlDt68V+iw8lfl7oBG oWU6OqnJSiJR85xeqj+sPP/pdfQv4piSMnr90lo= X-Google-Smtp-Source: AGs4zMaQizyVYryEfHhl4zEdErPlEBEkBAFMXTnPEE3vDkxpFoW6rDO4c89am+R3wV+1IB3Ycs7lH9AEZLPqQKDYk60= X-Received: by 10.55.4.136 with SMTP id 130mr29112080qke.76.1511287560360; Tue, 21 Nov 2017 10:06:00 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Allison Wang Date: Tue, 21 Nov 2017 18:05:49 +0000 Message-ID: Subject: Re: Logging To: dev@airflow.incubator.apache.org Content-Type: multipart/alternative; boundary="001a114c74f430570f055e820e04" archived-at: Tue, 21 Nov 2017 18:06:06 -0000 --001a114c74f430570f055e820e04 Content-Type: text/plain; charset="UTF-8" Hi William, The code is trying to use the first log handler that has name task_log_handler to fetch the log. There can only be one log handler used to retrieve the logs. On Tue, Nov 21, 2017 at 8:28 AM William Pursell wrote: > I will be the first to admit that I'm a little confused about logging, but > I'm hoping someone can clarify what I think is a bug. Or it's just my > misunderstanding of python. Or a misunderstanding about logging. > > I don't seem to be able to get much utility from having multiple log > handlers. And I'm curious about this line of code: > > https://github.com/apache/incubator-airflow/blob/master/airflow/www/views.py#L708 > > It feels like the code is trying to generate multiple possible handlers and > use the one that successfully finds the log, but the above mentioned line > is a bit of a fake generator. In the sense that it calls 'next' to grab > the next value from the generator, but since the generator's scope is just > the local function, it always just grabs the first handler. That is, other > than the default it might as well just be coded as a list comprehension: > > handler = [handler for handler in logger.handlers if handler.name == > task_log_reader][0] > > So my question is: is this attempting to use multiple log handlers to find > the log and not doing so because of a bug using 'next', or am I > misunderstanding what the log reader is trying to do? > --001a114c74f430570f055e820e04--