[issue2684] Logging Module still failing for %(filename)s, __init__

2008-04-24 Thread Charles Merriam

New submission from Charles Merriam <[EMAIL PROTECTED]>:

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:

[EMAIL PROTECTED]:~/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")
[EMAIL PROTECTED]:~/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.

--
components: Library (Lib)
messages: 65743
nosy: CharlesMerriam
severity: normal
status: open
title: Logging Module still failing for %(filename)s, __init__
type: behavior
versions: Python 2.5

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2684>
__
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2684] Logging Module still failing for %(filename)s, __init__

2008-04-24 Thread Charles Merriam

Charles Merriam <[EMAIL PROTECTED]> added the comment:

oops, last line should be "exits the stack frames for the logging
module.  This should be a once-per-program-execution event"

Hmm.. tracker should have a preview button.

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2684>
__
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2684] Logging Module still failing for %(filename)s, __init__

2008-04-25 Thread Charles Merriam

Charles Merriam <[EMAIL PROTECTED]> added the comment:

In my installation, line 1327 is within the logging.debug()  function,
specifically at the
call to  apply(root.debug, (msg,)+args, kwargs)

[EMAIL PROTECTED]:~/py$ rm *.pyc
[EMAIL PROTECTED]:~/py$ python x.py
DEBUG:logging/__init__.py:1327:Hello
[EMAIL PROTECTED]:~/py$ uname -a
Linux chasm-laptop 2.6.22-14-generic #1 SMP Tue Feb 12 07:42:25 UTC
2008 i686 GNU/Linux
[EMAIL PROTECTED]:~/py$ python -V
Python 2.5.1

-and then-
[EMAIL PROTECTED]:/usr/lib/python2.5$ sudo rm -rf *.pyc *.pyo */*.pyc
*/*.pyo */*/*.pyc */*/*.pyo
[EMAIL PROTECTED]:/usr/lib/python2.5$ cd ~/py
[EMAIL PROTECTED]:~/py$ python x.py
DEBUG:x.py:7:Hello
[EMAIL PROTECTED]:~/py$

So it was somewhere in the library brunches.  The uname -a translates
to "Kbuntu Gutsy".  Python, and extras like pylint, coverage, and
nose, were installed via Kbuntu's package manager.

-- Charles

On Fri, Apr 25, 2008 at 3:27 AM, Vinay Sajip <[EMAIL PROTECTED]> wrote:
>
>  Vinay Sajip <[EMAIL PROTECTED]> added the comment:
>
>  Can you confirm whether this problem occurs even after deleting all .pyc
>  and .pyo files, including in the Python library folders and your
>  application folders? Also, which specific platform is this happening on?
>
>  On your installation, is the line number 1327 the last line in
>  logging/__init__.py?
>
>  --
>  assignee:  -> vsajip
>  nosy: +vsajip
>
>
>
>  __
>  Tracker <[EMAIL PROTECTED]>
>  <http://bugs.python.org/issue2684>
>  __
>

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2684>
__
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com