Issue 20847: asyncio docs should call out that network logging is a no-no (original) (raw)

Created on 2014-03-03 20:12 by gvanrossum, last changed 2022-04-11 14:57 by admin.

Messages (7)
msg212664 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2014-03-03 20:12
The asyncio package uses the logging module. We should remind users that they should always configure their logs to go to a file on the local filesystem -- using any kind of network logging will block the event loop.
msg212666 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2014-03-03 20:31
Can we instead re-engineer asyncio logging to have logger calls in a separate thread? I.e. `logger` is a proxy object, that puts logging calls in a queue, and there would be another thread to block on the queue and do the actual logging. This way it won't really matter how logging is configured.
msg212671 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2014-03-03 20:55
If you really need network logging you should be able to configure a handler that puts things in a queue whose other end is serviced by an asyncio task. There should be no need to mess with the type of the logger object. Anyway, in 3.4 it is what it is. :-)
msg212689 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2014-03-03 23:44
> If you really need network logging you should be able to configure a handler that puts things in a queue whose other end is serviced by an asyncio task. There should be no need to mess with the type of the logger object. It's something that is easy to misconfigure. Having [logger+queue+logging thread] combination mitigates the risk a bit, but yeah, at the cost of increased complexity... > Anyway, in 3.4 it is what it is. :-) Right.
msg279181 - (view) Author: Mariatta (Mariatta) * (Python committer) Date: 2016-10-22 05:27
Hi, I added to asyncio logging doc that the log file should point to a file on local filesystem. Please review. Thanks :)
msg279184 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-10-22 07:05
+Logs for :mod:`asyncio` module should always point to a file on the local +filesystem. Using any kind of network logging will block the event loop. Well... even writing to a local file can block :-/ By "network", what about the local UNIX socket used by syslog? I guess that the safest option would be a new asyncio library running all logs functions to a thread, or maybe using loop.run_in_executor().
msg279371 - (view) Author: Марк Коренберг (socketpair) * Date: 2016-10-25 07:47
Typical network logging is using syslog UDP. Sending UDP is never block.
History
Date User Action Args
2022-04-11 14:57:59 admin set github: 65046
2016-11-02 21:28:11 Mariatta set files: - issue20847.patch
2016-10-25 16:39:46 gvanrossum set nosy: - gvanrossum
2016-10-25 07:47:47 socketpair set nosy: + socketpairmessages: +
2016-10-22 07:05:47 vstinner set messages: +
2016-10-22 05:27:18 Mariatta set files: + issue20847.patchnosy: + Mariattamessages: + keywords: + patch
2016-05-18 20:51:45 Winterflower set nosy: + Winterflower
2014-06-06 11:42:55 vstinner set components: + asyncio
2014-05-09 12:53:59 ezio.melotti set type: enhancementcomponents: + Documentationstage: needs patch
2014-03-07 21:45:34 eric.araujo set nosy: + eric.araujo
2014-03-03 23:44:58 yselivanov set messages: +
2014-03-03 20:55:43 gvanrossum set messages: +
2014-03-03 20:31:41 yselivanov set nosy: + yselivanovmessages: +
2014-03-03 20:12:20 gvanrossum create