There are a few layers of things going on here.

The first, and the reason for the landscape warning, is that logger
performs string formatting lazily and doing the formatting explicitly
results in extra processing for log levels that are being ignored.

The second is that the logger can be configured for % or format style
string formatting and the airflow logger is configured of % style.

It would be best if we chose a style for logging and then always used that
style, with lazy processing for logging.

I have seen projects that use % for logging (for log handler compatibility)
and {} for general string formatting.

--George

On Mon, Oct 17, 2016 at 8:22 AM Andrew Phillips <[email protected]> wrote:

> > My understanding from the latest python documentation is that
> > '.format' supersedes the use of '%'. Therefore, it seemed a little
> > strange that the Landscape configuration was advising the use of '%',
>
>
> I think the thing here is that the "%" that the warning is talking about
> is *not* the same operator that has been superseded by format, although
> it was very likely chosen to look similar, which is confusing.
>
> The warning is not telling the user to go back from:
>
>    logging.info("some message with a param {}".format(param))
>
> to
>
>    logging.info("some message with a param %s" % (param))
>
> but to a different argument passing style:
>
>    logging.info("some message with a param %s", param)
>
> Having said that, I'd also be up for disabling this warning if it's
> perceived as more of a nuisance that a useful hint.
>
> Regards
>
> ap
>

Reply via email to