Steven D'Aprano <steve+pyt...@pearwood.info> added the comment:
The call to logging.error() is irrelevant, since there's no expectation that the module-level function will necessarily output the same as a method of a specific instance logger.error(). I agree that is it quite curious that the first call to logger.error outputs something different from the second. The documentation says: The default format set by basicConfig() for messages is: severity:logger name:message ( Paragraph just above this: https://docs.python.org/3.5/howto/logging.html#logging-flow ) but you don't call basicConfig. I'm not sure that it is mandatory though. It looks like a bug to *me*, but I'm not a logging expert. I'm seeing the same behaviour in 3.5 and 3.7, but in 2.7.1 the first call to logger.error prints an error message: No handlers could be found for logger "main" ---------- nosy: +steven.daprano, vinay.sajip _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue35530> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com