By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,035 Members | 1,388 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,035 IT Pros & Developers. It's quick & easy.

[logging] problems in Python 2.3

P: n/a
I am using the standard "logging" module included with Python and it
seems it doesn't correctly identify the filename (and thus module name)
from where the logging method was called. In fact, no matter from which
module I call the logging method, the resulting log says that the
filename of the caller is:

\tmp\python.2664\usr\lib\python2.3\logging\__init_ _.py

(this seems to me like a reference to the logging module itself combined
with some sort of weird temporary storage)

This happens on my Windows98 machine both under Cygwin and under Windows
Python (both of them 2.3). When I try the exact same script on the Linux
server with Python 2.2 installed, it displays the filenames correctly.

--
Frantisek Fuka
(yes, that IS my real name)
(and it's pronounced "Fran-tjee-shek Foo-kah")
----------------------------------------------------
My E-mail: fu**@fuxoft.cz
My Homepage: http://www.fuxoft.cz
My ICQ: 2745855
Jul 18 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Frantisek Fuka <fu**@fuxoft.cz> wrote in message news:<c1***********@ns.felk.cvut.cz>...
I am using the standard "logging" module included with Python and it
seems it doesn't correctly identify the filename (and thus module name)
from where the logging method was called. In fact, no matter from which
module I call the logging method, the resulting log says that the
filename of the caller is:

\tmp\python.2664\usr\lib\python2.3\logging\__init_ _.py

(this seems to me like a reference to the logging module itself combined
with some sort of weird temporary storage)

This happens on my Windows98 machine both under Cygwin and under Windows
Python (both of them 2.3). When I try the exact same script on the Linux
server with Python 2.2 installed, it displays the filenames correctly.


Strange that it happens the same under Windows. Why would it be
looking for a Unix-like path such as the one you describe under
Windows, when not using cygwin?

Are you using "import logging" rather than "from logging import *" in
your script?
Jul 18 '05 #2

P: n/a
Vinay Sajip wrote:
Frantisek Fuka <fu**@fuxoft.cz> wrote in message news:<c1***********@ns.felk.cvut.cz>...
I am using the standard "logging" module included with Python and it
seems it doesn't correctly identify the filename (and thus module name)
from where the logging method was called. In fact, no matter from which
module I call the logging method, the resulting log says that the
filename of the caller is:

\tmp\python.2664\usr\lib\python2.3\logging\__ini t__.py

(this seems to me like a reference to the logging module itself combined
with some sort of weird temporary storage)

This happens on my Windows98 machine both under Cygwin and under Windows
Python (both of them 2.3). When I try the exact same script on the Linux
server with Python 2.2 installed, it displays the filenames correctly.

Strange that it happens the same under Windows. Why would it be
looking for a Unix-like path such as the one you describe under
Windows, when not using cygwin?

Are you using "import logging" rather than "from logging import *" in
your script?


Yes, I am using "import logging". And there is nothing like
"python.2664" in my cygwin "/tmp/" directory (and never was). My
application is in completely different directory. Also note that the
displayed filename has BACKSLASHES, not forward slashes.

--
Frantisek Fuka
(yes, that IS my real name)
(and it's pronounced "Fran-tjee-shek Foo-kah")
----------------------------------------------------
My E-mail: fu**@fuxoft.cz
My Homepage: http://www.fuxoft.cz
My ICQ: 2745855
Jul 18 '05 #3

P: n/a
Frantisek Fuka <fu**@fuxoft.cz> wrote in message news:<c1***********@ns.felk.cvut.cz>...
In fact, no matter from which module I call the logging method,
the resulting log says that the filename of the caller is: \tmp\python.2664\usr\lib\python2.3\logging\__init_ _.py (this seems to me like a reference to the logging module itself combined
with some sort of weird temporary storage)


Are you by any chance running from inside an editor, such as
emacs or even idle? If the module somehow gets hold of a
second sourcefile (and this looks like a copy tied to your
current process -- like the names for toplevel under emacs),
then this won't match the original __srcfile__.

You may wish to override the portion that finds a caller, so
that it will throw out, say, anything matching .*\logging\__init__.py([co])?

-jJ
Jul 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.