-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
Closed
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dirtopic-asynciotype-featureA feature request or enhancementA feature request or enhancement
Description
BPO | 20847 |
---|---|
Nosy | @vstinner, @merwok, @socketpair, @1st1, @Mariatta |
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:
assignee = 'https://github.com/vstinner'
closed_at = None
created_at = <Date 2014-03-03.20:12:20.295>
labels = ['type-feature', 'docs', 'expert-asyncio']
title = 'asyncio docs should call out that network logging is a no-no'
updated_at = <Date 2016-11-02.21:28:11.952>
user = 'https://github.com/gvanrossum'
bugs.python.org fields:
activity = <Date 2016-11-02.21:28:11.952>
actor = 'Mariatta'
assignee = 'vstinner'
closed = False
closed_date = None
closer = None
components = ['Documentation', 'asyncio']
creation = <Date 2014-03-03.20:12:20.295>
creator = 'gvanrossum'
dependencies = []
files = []
hgrepos = []
issue_num = 20847
keywords = ['patch']
message_count = 7.0
messages = ['212664', '212666', '212671', '212689', '279181', '279184', '279371']
nosy_count = 6.0
nosy_names = ['vstinner', 'eric.araujo', 'socketpair', 'yselivanov', 'Winterflower', 'Mariatta']
pr_nums = []
priority = 'normal'
resolution = None
stage = 'needs patch'
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue20847'
versions = ['Python 3.4']
Metadata
Metadata
Assignees
Labels
docsDocumentation in the Doc dirDocumentation in the Doc dirtopic-asynciotype-featureA feature request or enhancementA feature request or enhancement
Projects
Status
Done
Milestone
Relationships
Development
Select code repository
Activity
gvanrossum commentedon Mar 3, 2014
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.
1st1 commentedon Mar 3, 2014
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.gvanrossum commentedon Mar 3, 2014
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. :-)
1st1 commentedon Mar 3, 2014
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...
Right.
Mariatta commentedon Oct 22, 2016
Hi,
I added to asyncio logging doc that the log file should point to a file on local filesystem.
Please review. Thanks :)
vstinner commentedon Oct 22, 2016
+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().
socketpair commentedon Oct 25, 2016
Typical network logging is using syslog UDP. Sending UDP is never block.
37 remaining items
gh-65046: Link to logging cookbook from asyncio docs (#98207)
pythongh-65046: Link to logging cookbook from asyncio docs (pythonGH-…
pythongh-65046: Link to logging cookbook from asyncio docs (pythonGH-…
gh-65046: Link to logging cookbook from asyncio docs (GH-98207)
gh-65046: Link to logging cookbook from asyncio docs (GH-98207)
Merge branch 'main' into typewatch
Merge branch 'main' into cached_property
gh-65046: Link to logging cookbook from asyncio docs (GH-98207)
[3.11] gh-65046: Add note about logging from async code. (GH-97602) (G…
GH-65046: Fix docs about logging in `asyncio` (GH-97559)