warning users of problems with logging
Chris Curvey
ccurvey at gmail.com
Tue Apr 4 08:51:33 EDT 2006
The following code exists in logging/config.py
handlers[hand] = h
except: #if an error occurs when instantiating a handler, too bad
pass #this could happen e.g. because of lack of privileges
The problem here is that if something did go wrong instantiating the
handler, you have no idea what the problem was (permissions, syntax
error, wrong parameters), and later on you get a message like:
Traceback (most recent call last):
File "c:\python24\lib\logging\config.py", line 151, in fileConfig
log.addHandler(handlers[hand])
KeyError: 'default'
I propose that we change the code so that we have a fighting chance of
figuring out what's going on, like this:
handlers[hand] = h
except Exception, e: #if an error occurs when instantiating a
handler, too bad
print e #this could happen e.g. because of
lack of privileges
But I'm not sure if a "print" statement is the best way to go about it.
Any thoughts?
More information about the Python-list
mailing list