problem with logging when module not closed

M

max

I have an application which calls a module runx, in runx I import
logging and get a logger add handlers. I want to be able to rename
the file created by fileHandler.

several problems, I can't seem to be able to rename the file, calling
shutdown, or removeHandler and then hndlr.close(), I get No handlers
could be found for logger "root" even though I am not calling any
related methods.

The second problem I find if I re-enter my module and call addhandler
of a handler that has not been removed everything gets output twice,
then three times... removing the handler seems to fix this, shutdown
doesn't, in fact if I call shutdown and not remove the handlers,
everything is repeated mult times on subsequent calles and I get
ValueError IO operation on closed file.

When I run an app from within the debugger which imports logging I get
similar problems, messages repeated because the app is not removing
handlers, is it best practice to always remove handlers that have been
added, what does shutdown do?

Any light on sequence to start and terminate logging, and is it
possible to get the file opened by ::FileHandler()

thanks
max
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,602
Members
45,182
Latest member
BettinaPol

Latest Threads

Top