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

Add NOTICE level to the logging module #75944

Closed
tb3088 mannequin opened this issue Oct 11, 2017 · 5 comments
Closed

Add NOTICE level to the logging module #75944

tb3088 mannequin opened this issue Oct 11, 2017 · 5 comments
Assignees
Labels
3.7 (EOL) end of life stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@tb3088
Copy link
Mannequin

tb3088 mannequin commented Oct 11, 2017

BPO 31763
Nosy @rhettinger, @vsajip, @bitdancer, @tb3088
PRs
  • bpo-31763: Add NOTICE level to the logging module #3957
  • 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/vsajip'
    closed_at = <Date 2017-10-14.06:10:26.506>
    created_at = <Date 2017-10-11.18:48:25.530>
    labels = ['3.7', 'type-feature', 'library']
    title = 'Add NOTICE level to the logging module'
    updated_at = <Date 2017-10-14.06:10:26.504>
    user = 'https://github.com/tb3088'

    bugs.python.org fields:

    activity = <Date 2017-10-14.06:10:26.504>
    actor = 'rhettinger'
    assignee = 'vinay.sajip'
    closed = True
    closed_date = <Date 2017-10-14.06:10:26.506>
    closer = 'rhettinger'
    components = ['Library (Lib)']
    creation = <Date 2017-10-11.18:48:25.530>
    creator = 'mp5023'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 31763
    keywords = ['patch']
    message_count = 5.0
    messages = ['304168', '304171', '304218', '304274', '304380']
    nosy_count = 4.0
    nosy_names = ['rhettinger', 'vinay.sajip', 'r.david.murray', 'mp5023']
    pr_nums = ['3957']
    priority = 'normal'
    resolution = 'rejected'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue31763'
    versions = ['Python 3.7']

    @tb3088
    Copy link
    Mannequin Author

    tb3088 mannequin commented Oct 11, 2017

    This was inspired by 31732.
    The logging module has 5 log levels: CRITICAL, ERROR, WARNING, INFO, DEBUG per https://docs.python.org/dev/library/logging.html#logging-levels

    However syslog(3) has for decades defined NOTICE and I can't think of a good reason why this level was carried through. It serves a very useful distinction from routine and not really attention-worthy messages (INFO) but don't rise to actual WARNINGs. Things like failed authentication attempts are not warnings but also not messages to casually ignore. Hence NOTICE. Individual timed out connection attempts but before all attempts exhausted, and many other examples exist.

    @tb3088 tb3088 mannequin added 3.7 (EOL) end of life stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Oct 11, 2017
    @bitdancer
    Copy link
    Member

    I fixed the title for you, otherwise this looks like a duplicate of bpo-31732.

    @bitdancer bitdancer changed the title Add TRACE level to the logging module Add NOTICE level to the logging module Oct 11, 2017
    @rhettinger
    Copy link
    Contributor

    As mentioned in the other tracker item, I'm against adding another level. While it might serve an exotic need, I think most users would be worse off having to learn and think about yet another level of distinction. The mental costs would be on going.

    FWIW, users already have the ability to define new levels (as simply as: SEMI_INTERESTING=25) but we rarely see this in practice. The long and successful history of this module is somewhat strong evidence that the current five levels suffice for most users, most of the time.

    @tb3088
    Copy link
    Mannequin Author

    tb3088 mannequin commented Oct 12, 2017

    syslog(3) is cited in the code as inspiration and has been the goto definition for logging levels for 40 years across many, many projects. NOTICE is incredibly useful especially to those of us who are sysadmins.

    Why would Python not implement the full suite of syslog levels? Admittedly the case for ALERT and EMERGENCY might be a stretch. It at least doesn't hobble those who want to use them. Without proper coverage one has to settle for unnecessary jumbling of Noteworthy items being buried in the torrent of Informational but not really interesting items.

    eg. INFO for attempting a connection. NOTICE for temporary service unavailability or handshake timeout, WARNING (maybe ERROR) for retry exhausted depending on what the failure means to the app.

    eg. INFO for login attempts. NOTICE for password expiry date approaching, for failed logins (bad username/passwords, locked/expired account), for password change attempts, for temporary Federated Auth connect failure. None of which rise to the level of WARNING.

    @rhettinger
    Copy link
    Contributor

    Marking as rejected/closed for the reasons cited in bpo-31732. In particular, see Vinay Sajip's commentary in https://bugs.python.org/msg304318 where he notes that it was a specific design decision to not emulate syslog(3) in this regard.

    @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 stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants