[ python-Bugs-968245 ] Python Logging filename & file number (original) (raw)

SourceForge.net noreply at sourceforge.net
Wed Jul 14 17:31:27 CEST 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: Python 2.3 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: propmancmd:95 stateOnly is: DE propmancmd:105 MEssages ......... propmancmd:107 collecting datasource: 1011 propman:98 Collectors overwrite existing pickle files: 0 propman:99 Collectors run in multiple threads: 4 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:

<__init__:988> stateOnly is: DE <__init__:988> MEssages <__init__:988> collecting datasource: 1011 <__init__:988> Collectors overwrite existing pickle files: 0 <__init__:988> Collectors run in multiple threads: 4 <__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-07-14 10:31

Message: Logged In: YES user_id=1058618

Hi , I have attached a script to reproduce the error, jsut run ./test.py in the folder.

This is what freebsd produces: $ python ./test.py 2004-07-14 11:29:47,067 test:9 This is a inof call. 2004-07-14 11:29:47,069 test:10 This is a warn call. 2004-07-14 11:29:47,069 test:11 This is a error call.

This is what redhat produces: $ python ./test.py 2004-07-14 11:28:24,812 <__init__:988> This is a info call. 2004-07-14 11:28:24,812 <__init__:988> This is a warn call. 2004-07-14 11:28:24,812 <__init__:988> This is a error call.

As you can see, the filename:fileno attributes are different.


Comment By: Ryan (superleo303) Date: 2004-07-12 08:35

Message: Logged In: YES user_id=1058618

Sorry, no , i just have been very busy and havent had time to reproduce the error, i promise by tomorrow ill have a small set of scripts to reproduce the error. All the linux boxes, which is 4 of them, are red hat 9.0, so maybe its only a problem with red hat? Ill be posting the scripts tomorrow. Thanks for checking into this

-Ryan

ps - i wasnt able to send you an email, it said:

<vsajip at users.sourceforge.net>: host mail.sourceforge.net[66.35.250.206] said: 550 Administrative prohibition

<vsajip at sourceforge.net>: host mail.sourceforge.net[66.35.250.206] said: 550 Administrative prohibition


Comment By: Vinay Sajip (vsajip) Date: 2004-07-05 07:06

Message: Logged In: YES user_id=308438

I'm not able to reproduce these problems under Linux - I only have access to Mandrake 10.0 (a Red Hat variant).

Can you upload a script or set of scripts which demonstrates the problem?


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