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: logging module: default levels do not work as documented.
Type: Stage:
Components: Library (Lib) Versions: Python 2.3
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: vinay.sajip Nosy List: roysmith, vinay.sajip
Priority: normal Keywords:

Created on 2004-07-20 10:11 by roysmith, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
logTest.py roysmith, 2004-07-20 10:11
Messages (2)
msg21715 - (view) Author: Roy Smith (roysmith) Date: 2004-07-20 10:11
I'm running:

Roy-Smiths-Computer:unit$ uname -a
Darwin Roy-Smiths-Computer.local 7.4.0 Darwin Kernel Version 
7.4.0: Wed May 12 16:58:24 PDT 2004; root:xnu/xnu
-517.7.7.obj~7/RELEASE_PPC  Power Macintosh powerpc

Roy-Smiths-Computer:unit$ py
Python 2.3.4 (#3, Jun 29 2004, 21:48:03) 
[GCC 3.3 20030304 (Apple Computer, Inc. build 1495)] on darwin
Type "help", "copyright", "credits" or "license" for more 
information.

Under "6.28.2 Handler Objects", it says:

"setLevel(lvl)  Sets the threshold for this handler to lvl. Logging 
messages which are less severe than lvl will be ignored. When a 
handler is created, the level is set to NOTSET (which causes all 
messages to be processed)."

The default level of NOTSET does not work as advertised.  The 
attached program prints:

---------------
ERROR two
DEBUG three
ERROR four
---------------

The first line, "DEBUG one", was not processed.

msg21716 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2004-07-21 14:27
Logged In: YES 
user_id=308438

The level for a handler is different from a level for a logger. 
Filtering first happens at logger level - then at handler level. 
The default level for the root logger is WARNING - hence the 
initial debug message is not printed, but the next one is - 
because you have perviously set the level to DEBUG.
History
Date User Action Args
2022-04-11 14:56:05adminsetgithub: 40602
2004-07-20 10:11:30roysmithcreate