logging error with RotatingFileHandler
flupke
flupke at nonexistingdomain.com
Tue Jun 27 20:11:26 EDT 2006
Vinay Sajip wrote:
> flupke wrote:
>
>
>> File "C:\Python24\lib\logging\handlers.py", line 134, in doRollover
>> self.handleError(record)
>>NameError: global name 'record' is not defined
>
>
> There's a bug in doRollover's exception handling, which is masking the
> true error - which is most probably an exception being thrown in
> os.rename.
>
> I'll look at fixing this bug asap. Most likely, it'll be done by let
> the exception propagate up from doRollover to its caller.
>
> Regards,
>
> Vinay Sajip
>
OK Vinjay,
thanks for the info.
If this bug is fixed, where will i find a fixed version and how do i
install it?
Also, more important to me, what am i doing wrong to get this error
message in the first place?
I could reproduce the error with this program:
import logging
import logging.config
LOGFILE = r"logconf.ini"
logging.config.fileConfig(LOGFILE)
class TypeA(object):
def __init__(self):
#logging.config.fileConfig(LOGFILE)
self.log = logging.getLogger('logfile')
self.dolog("Starting the program")
def dolog(self,text):
self.log.debug(text)
class TypeB(TypeA):
def __init__(self):
super(TypeB,self).__init__()
# put this line in comment to prevent the error
logging.config.fileConfig(LOGFILE)
#self.log = logging.getLogger('logfile')
self.log.debug("Starting class B")
for nr_of_lognr in range(0,2000):
b = TypeB()
b.dolog("This is a test to see if logging works and more
specifically the RotatingFileHandler functionallity")
It seemed as if the "logging.config.fileConfig(LOGFILE)" line in Type B
is to blame. I changed the code of my big program to reflect this change
yet i still get this error.
I didn't get this with an earlier version of python.
Regards,
Benedict
More information about the Python-list
mailing list