By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,213 Members | 1,105 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,213 IT Pros & Developers. It's quick & easy.

problem with logging when module not closed

P: n/a
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()

Jul 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.