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.

Author CharlesMerriam
Recipients CharlesMerriam
Date 2008-04-24.19:51:26
SpamBayes Score 0.0020997098
Marked as misclassified No
Message-id <1209066689.35.0.514393267186.issue2684@psf.upfronthosting.co.za>
In-reply-to
Content
About same as problem in 2.4 Issue1470422 closed without a test case on
MacOS X/Python 2.4.
Also same as
http://mail.python.org/pipermail/python-bugs-list/2004-July/024111.html
and so on back for years.

What happens:

chasm@chasm-laptop:~/py$ cat x.py
import logging
logging.basicConfig(level=logging.DEBUG,
                   
format="%(levelname)s:%(pathname)s:%(lineno)d:%(message)s")
from logging import debug

if __name__ == "__main__":
    debug("Hello")
chasm@chasm-laptop:~/py$ python x.py
DEBUG:logging/__init__.py:1327:Hello

What should happen:

It should print DEBUG: x.py:3:Hello

Why it fails:

Because logging guesses that the right sys._getframe(level) should be
level 3 in __init__.py:71, in currentFrame
if hasattr(sys, '_getframe'): currentframe = lambda: sys._getframe(3)

What should happen:

It shouldn't guess.  In Python 2.5, the lambda might count.  In any
case, the level is off by one (4).  I suggest that it get set by walking
up the stack from until it exits the stack frame.
History
Date User Action Args
2008-04-24 19:51:29CharlesMerriamsetspambayes_score: 0.00209971 -> 0.0020997098
recipients: + CharlesMerriam
2008-04-24 19:51:29CharlesMerriamsetspambayes_score: 0.00209971 -> 0.00209971
messageid: <1209066689.35.0.514393267186.issue2684@psf.upfronthosting.co.za>
2008-04-24 19:51:27CharlesMerriamlinkissue2684 messages
2008-04-24 19:51:26CharlesMerriamcreate