This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Doc: Logging level order seems inconsistent
Type: Stage:
Components: Library (Lib) Versions: Python 3.1, Python 3.2, Python 2.7, Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: vinay.sajip Nosy List: terry.reedy, vinay.sajip
Priority: normal Keywords:

Created on 2009-10-24 22:58 by terry.reedy, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg94439 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2009-10-24 22:58
LibRef 15.6, Logging module:
<Assigned to Vinay because I understand you to be the current maintainer
of logging. If wrong, please reassign.>

Intro start with "The default levels provided are DEBUG, INFO, WARNING,
ERROR and CRITICAL." which seems like the proper ordering. Then

15.6.1.1. Simple examples
"Another useful feature of the logging API is the ability to produce
different messages at different log levels. This allows you to
instrument your code with debug messages, for example, but turning the
log level down so that those debug messages are not written for your
production system. The default levels are CRITICAL, ERROR, WARNING,
INFO, DEBUG and NOTSET.

The logger, handler, and log message call each specify a level. The log
message is only emitted if the handler and logger are configured to emit
messages of that level or lower. "

Ie, the order is reversed and the level specified is the highest level
emitted, which struck me as backwards, versus

15.6.1.2. Loggers
"Logger.setLevel() specifies the lowest-severity log message a logger
will handle, where debug is the lowest built-in severity level and
critical is the highest built-in severity. "

so that it emits the that level or *higher*.
(although notset is the actual lowest built-in.)

Reading further, I see that the builtin levels range for NOTSET=0 to
CRITICAL=50 (15.6.2. Logging Levels), so I think the first quote should
be changed to

"Another useful feature of the logging API is the ability to produce
different messages at different log levels. This allows you to
instrument your code with debug messages, for example, but turning the
log level up so that those debug messages are not written for your
production system. The default levels are NOTSET, DEBUG, INFO, WARNING,
ERROR, and CRITICAL.

The logger, handler, and log message call each specify a level. The log
message is only emitted if the handler and logger are configured to emit
messages of that level or higher. "

I have not checked the rest of the doc for other backwards passages.
msg94642 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2009-10-28 23:29
Fix checked into trunk, release26-maint, py3k.
History
Date User Action Args
2022-04-11 14:56:54adminsetgithub: 51448
2009-10-28 23:29:11vinay.sajipsetstatus: open -> closed
resolution: fixed
messages: + msg94642
2009-10-24 22:58:49terry.reedycreate