[ python-Bugs-968245 ] Python Logging filename & file number

SourceForge.net noreply at sourceforge.net
Thu Jun 10 13:18:47 EDT 2004


Bugs item #968245, was opened at 2004-06-07 10:49
Message generated for change (Comment added) made by superleo303
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=968245&group_id=5470

Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Ryan (superleo303)
Assigned to: Vinay Sajip (vsajip)
Summary: Python Logging filename & file number 

Initial Comment:
I use Freebsd and redhat 9.0 linus at work.

Using Python Logging filename & file number on freebsd
works fine.
When i print a log statement, and have my config
formatter section set like:
[formatter_default]
format=%(asctime)s <%(levelname)s>
<%(module)s:%(lineno)s> %(message)s
datefmt=

On bsd my logs look like:
<INFO> <propmancmd:95> stateOnly is: DE
<INFO> <propmancmd:105>  MEssages .........
<INFO> <propmancmd:107> collecting datasource: 1011
<INFO> <propman:98>   Collectors overwrite existing
pickle files: 0
<INFO> <propman:99>           Collectors run in
multiple threads: 4
<DEBUG> <propman:528> sql is:
...

See, the filename and file number get displayed with
each logging call,

Now, The same exact code run on the same exact version
of python on a linux machine yiedls the lines:

<INFO> <__init__:988> stateOnly is: DE
<INFO> <__init__:988>  MEssages
<INFO> <__init__:988> collecting datasource: 1011
<INFO> <__init__:988>   Collectors overwrite existing
pickle files: 0
<INFO> <__init__:988>           Collectors run in
multiple threads: 4
<DEBUG> <__init__:988> sql is: 
...

So i opened up ./python2.3/logging/__init__.py  line
988 and it seems to be where the problem is.

Can someone take a look at this asap?   I have to run
all my code on linux machines, so now i cant see which
file and which line is making the logging.

To reproduce, get a freebsd and linux machine,
then run a simple script that uses logging config files
and use the above example as your formatter in the
logging confrig file,

BSD should show the filenames and numbers, linux should
show __init__ 988 instead.


----------------------------------------------------------------------

>Comment By: Ryan (superleo303)
Date: 2004-06-10 12:18

Message:
Logged In: YES 
user_id=1058618

vsajip, i tested on both machines, both machines returned
the same results:

STACKWALKER RESULTS RUN ON LINUX RED HAT 9.0

[rsmith at marge]:~/ned$ cd bin/testing/stackwalk/
[rsmith at marge]:~/ned/bin/testing/stackwalk$ python sw1.py
[rsmith at marge]:~/ned/bin/testing/stackwalk$ python sw2.py
[rsmith at marge]:~/ned/bin/testing/stackwalk$ python sw3.py
[rsmith at marge]:~/ned/bin/testing/stackwalk$ python sw4.py
[rsmith at marge]:~/ned/bin/testing/stackwalk$ python stackwalk.py
[rsmith at marge]:~/ned/bin/testing/stackwalk$ python getcaller.py
/home/rsmith/ned/bin/testing/stackwalk/sw1.py(4)
/home/rsmith/ned/bin/testing/stackwalk/sw2.py(5)
/home/rsmith/ned/bin/testing/stackwalk/sw3.py(6)
/home/rsmith/ned/bin/testing/stackwalk/sw4.py(7)
getcaller.py(3)
[rsmith at marge]:~/ned/bin/testing/stackwalk$


-------------------------------------------------------------------------

STACKWALKER RESULTS RUN ON FREEBSD 5.2.1-RELEASE-p8

[ryan at dev2]:~/ned$ cd bin/testing/stackwalk/
[ryan at dev2]:~/ned/bin/testing/stackwalk$ python sw1.py
[ryan at dev2]:~/ned/bin/testing/stackwalk$ python sw2.py
[ryan at dev2]:~/ned/bin/testing/stackwalk$ python sw3.py
[ryan at dev2]:~/ned/bin/testing/stackwalk$ python sw4.py
[ryan at dev2]:~/ned/bin/testing/stackwalk$ python stackwalk.py
[ryan at dev2]:~/ned/bin/testing/stackwalk$ python getcaller.py
/usr/home/ryan/ned/bin/testing/stackwalk/sw1.py(4)
/usr/home/ryan/ned/bin/testing/stackwalk/sw2.py(5)
/usr/home/ryan/ned/bin/testing/stackwalk/sw3.py(6)
/usr/home/ryan/ned/bin/testing/stackwalk/sw4.py(7)
getcaller.py(3)
[ryan at dev2]:~/ned/bin/testing/stackwalk$

----------------------------------------------------------------------

Comment By: Vinay Sajip (vsajip)
Date: 2004-06-09 04:26

Message:
Logged In: YES 
user_id=308438

The problem appears to be related to some underlying 
problem with sys._getframe(). Can you please download the 
attached stackwalk.tar.gz and run it on both FreeBSD and 
Linux? Please post your findings here, thanks. Note that the 
stackwalk stuff contains no calls to the logging package.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=968245&group_id=5470



More information about the Python-bugs-list mailing list