Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logging.handlers.QueueHandler acts unexpected #88639

Closed
kaijmueller mannequin opened this issue Jun 21, 2021 · 4 comments
Closed

logging.handlers.QueueHandler acts unexpected #88639

kaijmueller mannequin opened this issue Jun 21, 2021 · 4 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes 3.10 only security fixes 3.11 only security fixes docs Documentation in the Doc dir type-feature A feature request or enhancement

Comments

@kaijmueller
Copy link
Mannequin

kaijmueller mannequin commented Jun 21, 2021

BPO 44473
Nosy @vsajip, @miss-islington, @jdevries3133
PRs
  • bpo-44473: Update docstring and documentation for QueueHandler.prepar… #27140
  • 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 = None
    closed_at = <Date 2021-07-28.10:46:03.613>
    created_at = <Date 2021-06-21.13:04:38.286>
    labels = ['3.7', '3.8', '3.9', '3.10', '3.11', 'type-feature', 'docs']
    title = 'logging.handlers.QueueHandler acts unexpected'
    updated_at = <Date 2021-07-28.10:46:03.613>
    user = 'https://bugs.python.org/kaijmueller'

    bugs.python.org fields:

    activity = <Date 2021-07-28.10:46:03.613>
    actor = 'vinay.sajip'
    assignee = 'docs@python'
    closed = True
    closed_date = <Date 2021-07-28.10:46:03.613>
    closer = 'vinay.sajip'
    components = ['Documentation']
    creation = <Date 2021-06-21.13:04:38.286>
    creator = 'kai.jmueller'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 44473
    keywords = ['patch']
    message_count = 4.0
    messages = ['396243', '397504', '397518', '397540']
    nosy_count = 5.0
    nosy_names = ['vinay.sajip', 'docs@python', 'miss-islington', 'jack__d', 'kai.jmueller']
    pr_nums = ['27140']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue44473'
    versions = ['Python 3.6', 'Python 3.7', 'Python 3.8', 'Python 3.9', 'Python 3.10', 'Python 3.11']

    @kaijmueller
    Copy link
    Mannequin Author

    kaijmueller mannequin commented Jun 21, 2021

    According to the docstring of logging.handlers.QueueHandler
    "The base implementation formats the record to merge the message and arguments, and removes unpickleable items from the record in-place."
    But, if a just a log message is used w/o any arguments, the arguments are still set to None, which IMHO unexpected. Especially, according to the typeshed project, the "args" is ALWAYS either a dict or a tuple. But in this case, they are set to None which surprised my a lot.

    Would it be possible to improve the docstring to state, that args, exc_info, exc_text are set to None and that msg is overwritten. If you miss this tiny but very important detail, additional handlers can act very wrong.
    In addition, it seems to be that the type information needs to be improved in typeshed or are there any other plans on your side?

    @kaijmueller kaijmueller mannequin added 3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes 3.10 only security fixes 3.11 only security fixes labels Jun 21, 2021
    @kaijmueller kaijmueller mannequin assigned docspython Jun 21, 2021
    @kaijmueller kaijmueller mannequin added docs Documentation in the Doc dir type-feature A feature request or enhancement 3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes 3.10 only security fixes 3.11 only security fixes labels Jun 21, 2021
    @kaijmueller kaijmueller mannequin assigned docspython Jun 21, 2021
    @kaijmueller kaijmueller mannequin added docs Documentation in the Doc dir type-feature A feature request or enhancement labels Jun 21, 2021
    @jdevries3133
    Copy link
    Mannequin

    jdevries3133 mannequin commented Jul 14, 2021

    I have another question about the docstring in the source beneath logging.handlers.QueueHandler.prepare. It says:

    The object returned by this method is enqueued.

    But, the prepare method doesn't do the enqueuing operation, it just prepares the record and returns it back, so it seems like this statement is not accurate?

    @miss-islington
    Copy link
    Contributor

    New changeset 3b8075f by Vinay Sajip in branch 'main':
    bpo-44473: Update docstring and documentation for QueueHandler.prepar… (GH-27140)
    3b8075f

    @vsajip
    Copy link
    Member

    vsajip commented Jul 15, 2021

    But, the prepare method doesn't do the enqueuing operation, it just prepares the record and returns it back, so it seems like this statement is not accurate?

    It merely states what happens to the return value. It doesn't say it has already been enqueued. If you look at the entire documentation for the class (rather than just individual sentences) I don't think the way the class works is unclear.

    @vsajip vsajip closed this as completed Jul 28, 2021
    @vsajip vsajip closed this as completed Jul 28, 2021
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes 3.10 only security fixes 3.11 only security fixes docs Documentation in the Doc dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants