airflow-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Allison Wang <allisonwang...@gmail.com>
Subject Re: Logging
Date Tue, 21 Nov 2017 18:05:49 GMT
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 <williamp@wepay.com> 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?
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message