473,398 Members | 2,403 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

[logging] problems in Python 2.3

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
3 1556
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Robert.Schmitt | last post by:
I found that the configuration system of the new logging package of Python 2.3 has some unintuitive idiosyncracies that are worth mentioning because they can cost you quite some development time...
3
by: Jeff Shannon | last post by:
I'm having some difficulty getting my logging configuration set correctly. I'm using a config file (copied at end of post), with the intent of setting several loggers which write to a combination...
23
by: Rotem | last post by:
Hi, while working on something in my current project I have made several improvements to the logging package in Python, two of them are worth mentioning: 1. addition of a logging record field...
2
by: Chris Curvey | last post by:
The following code exists in logging/config.py handlers = h except: #if an error occurs when instantiating a handler, too bad pass #this could happen e.g. because of lack of privileges ...
0
by: robert | last post by:
As more and more python packages are starting to use the bloomy (Java-ish) 'logging' module in a mood of responsibility and as I am not overly happy with the current "thickener" style of usage, I...
3
by: nicholas.petrella | last post by:
I am currently trying to use the python logging system as a core enterprise level logging solution for our development and production environments. The rotating file handler seems to be what I...
4
by: Alia Khouri | last post by:
I've been struggling with the logging module in the stdlib which seems to me rather counter-intuitive: For some reason it refuses to recognize configuration options when they are set inside a...
4
by: samwyse | last post by:
In the Python 2.5 Library Reference, section 14.5.3 (Logging to multiple destinations), an example is given of logging to both a file and the console. This is done by using logging.basicConfig()...
4
by: Matthew Wilson | last post by:
I'm working on a package that uses the standard library logging module along with a .cfg file. In my code, I use logging.config.fileConfig('/home/matt/mypackage/matt.cfg') to load in the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.