Skip to content

asyncio docs should call out that network logging is a no-no #65046

@gvanrossum

Description

@gvanrossum
Member
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']

Activity

gvanrossum

gvanrossum commented on Mar 3, 2014

@gvanrossum
MemberAuthor

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

1st1 commented on Mar 3, 2014

@1st1
Member

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

gvanrossum commented on Mar 3, 2014

@gvanrossum
MemberAuthor

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

1st1 commented on Mar 3, 2014

@1st1
Member

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.

added
docsDocumentation in the Doc dir
type-featureA feature request or enhancement
on May 9, 2014
Mariatta

Mariatta commented on Oct 22, 2016

@Mariatta
Member

Hi,
I added to asyncio logging doc that the log file should point to a file on local filesystem.
Please review. Thanks :)

vstinner

vstinner commented on Oct 22, 2016

@vstinner
Member

+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

socketpair commented on Oct 25, 2016

@socketpair
Mannequin

Typical network logging is using syslog UDP. Sending UDP is never block.

transferred this issue fromon Apr 10, 2022

37 remaining items

added a commit that references this issue on Oct 12, 2022
c39a0c3
added a commit that references this issue on Oct 12, 2022
added a commit that references this issue on Oct 12, 2022
Repository owner moved this from In Progress to Done in asyncioon Oct 12, 2022
added 2 commits that reference this issue on Oct 12, 2022
bd73110
3165901
added 3 commits that reference this issue on Oct 22, 2022
168ec08
8de3533
e65e6de
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

docsDocumentation in the Doc dirtopic-asynciotype-featureA feature request or enhancement

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @vsajip@vstinner@1st1@merwok@gvanrossum

    Issue actions

      asyncio docs should call out that network logging is a no-no · Issue #65046 · python/cpython