Repository navigation
asyncio docs should call out that network logging is a no-no #65046
Description
Activity
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.
Can we instead re-engineer asyncio logging to have logger calls in a separate thread?
I.e.
loggeris 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.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. :-)
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.
- addeddocsDocumentation in the Doc dirDocumentation in the Doc dirtype-featureA feature request or enhancementA feature request or enhancement
on May 9, 2014 Hi,
I added to asyncio logging doc that the log file should point to a file on local filesystem.
Please review. Thanks :)+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().Typical network logging is using syslog UDP. Sending UDP is never block.
28 remaining items
- added a commit that references this issue
on Oct 12, 2022 - added 2 commits that reference this issue
on Oct 14, 2022
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsDone
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields: