[Patches] [ python-Patches-725904 ] Minor changes to logging

SourceForge.net noreply@sourceforge.net
Fri, 25 Apr 2003 03:18:51 -0700


Patches item #725904, was opened at 2003-04-22 22:37
Message generated for change (Comment added) made by vsajip
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=725904&group_id=5470

Category: Library (Lib)
Group: Python 2.3
Status: Open
Resolution: Accepted
Priority: 7
Submitted By: Vinay Sajip (vsajip)
Assigned to: Neal Norwitz (nnorwitz)
Summary: Minor changes to logging

Initial Comment:
__init__.py:
1. Updated version number to 0.4.8 and status to beta.
handlers.py:
1. Replaced explicit Python version check with hasattr to 
determine the running Python's capability.
2. Added Date: header to SMTPHandler
3. Changed HTTPHandler to allow more flexible mapping 
of a LogRecord to a dictionary to be urlencoded.

Regression test ran OK on my system after these 
changes were made.


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

>Comment By: Vinay Sajip (vsajip)
Date: 2003-04-25 10:18

Message:
Logged In: YES 
user_id=308438

I attach an updated test_logging.py and output/test_logging 
which avoids the use of thread.join() and uses a condition 
variable instead to synchronize threads. In addition, the TCP 
thread automatically terminates when it sees an end-of-test 
sentinel.

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

Comment By: Guido van Rossum (gvanrossum)
Date: 2003-04-24 00:32

Message:
Logged In: YES 
user_id=6380

Vinaj, I suggest that you don't focus on trying to reproduce
the problem but study the way you have structured the tests
to show to yourself that it *is* possible.  Then think about
a restructuring that avoids this.  E.g. by using an event
variable (see the threading module).  If that doesn't work
for Python 1.5.2,  that doesn't matter IMO.

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

Comment By: Vinay Sajip (vsajip)
Date: 2003-04-23 22:46

Message:
Logged In: YES 
user_id=308438

I can try to look into this, although I don't have access to Red 
Hat 9. I have limited access to Mandrake 9 and will try to run 
tests in that environment; I may not be able to reproduce it. I 
have no problem with simplifying the test - the reason for 
using threads is to give the logging system a reasonably good 
workout. test_logging.py is already quite a bit simpler than 
the test harness I use personally. While the test does create 
threads, it does seem to follow established practice and there 
is no obvious (to me) reason for the problem.

Resolving this issue should not require a change to the API - if 
the worst comes to the worst, we can simplify test_logging to 
do minimal logic tests for logger/handler logic.

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

Comment By: Guido van Rossum (gvanrossum)
Date: 2003-04-23 18:22

Message:
Logged In: YES 
user_id=6380

If adding a small sleep to the code "fixes" the problem,
there is still a more fundamental problem with the tests.
Vinaj, can you look into this? Do you understand the issue?
I wonder if maybe the tests shouldn't be thread-based at all.

It is okay if this doesn't get resolved before the b1
release; there will be a b2 release a month later. (As long
as it doesn't require API changes -- bugfixes or changes to
the test suite are okay though.)

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

Comment By: Neal Norwitz (nnorwitz)
Date: 2003-04-23 03:52

Message:
Logged In: YES 
user_id=33168

Checked in as:
 * Lib/logging/__init__.py: 1.9
 * Lib/logging/handlers.py: 1.6

I still have the test failure problem.  It's more consistent
on Redhat 9.  Adding a time.sleep(.1) to the test as the
first statement in the finally: in test_main() (line 458)
"fixes" the problem.  Although this is a hack that I don't
want to check in.

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

Comment By: Guido van Rossum (gvanrossum)
Date: 2003-04-23 00:29

Message:
Logged In: YES 
user_id=6380

Unassigning and accepting; someone else please apply this!

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

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