Title: Add NOTICE level to the logging module
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.7
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: vinay.sajip Nosy List: mp5023, r.david.murray, rhettinger, vinay.sajip
Priority: normal Keywords: patch

Created on 2017-10-11 18:48 by mp5023, last changed 2017-10-14 06:10 by rhettinger. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 3957 closed mp5023, 2017-10-11 18:54
Messages (5)
msg304168 - (view) Author: Matthew Patton (mp5023) * Date: 2017-10-11 18:48
This was inspired by 31732.
The logging module has 5 log levels: CRITICAL, ERROR, WARNING, INFO, DEBUG per

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.
msg304171 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2017-10-11 18:53
I fixed the title for you, otherwise this looks like a duplicate of issue 31732.
msg304218 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2017-10-12 08:06
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.
msg304274 - (view) Author: Matthew Patton (mp5023) * Date: 2017-10-12 18:05
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.
msg304380 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2017-10-14 06:10
Marking as rejected/closed for the reasons cited in Issue 31732.  In particular, see Vinay Sajip's commentary in where he notes that it was a specific design decision to not emulate syslog(3) in this regard.
Date User Action Args
2017-10-14 06:10:26rhettingersetstatus: open -> closed
resolution: rejected
messages: + msg304380

stage: patch review -> resolved
2017-10-12 18:05:31mp5023setmessages: + msg304274
2017-10-12 08:06:24rhettingersetassignee: vinay.sajip

messages: + msg304218
nosy: + rhettinger, vinay.sajip
2017-10-11 18:54:54mp5023setkeywords: + patch
stage: patch review
pull_requests: + pull_request3932
2017-10-11 18:53:09r.david.murraysetnosy: + r.david.murray

messages: + msg304171
title: Add TRACE level to the logging module -> Add NOTICE level to the logging module
2017-10-11 18:48:25mp5023create