-------- Original Message -------- Subject: Re: Logging question Date: Tue, 15 Dec 2009 18:28:54 +0000 From: Vinay Sajip at Red Dove <vinay_sa...@red-dove.com> To: Yaroslav Molochko <ono...@gmail.com>
On 15/12/2009 14:29, Yaroslav Molochko wrote: > Hello Vinay Sajip, > > my name is Yaroslav, I'm trying to use your logging module, and it's > working quite good. There is one issue I've figure out: > > logging.basicConfig(filename=c_logfile, > level=logging_level, # By default logging is > in INFO mode. You can change it to DEBUG by -v variable > format="gert > :%(asctime)-10s%(msecs)d:%(levelname)s: %(message)s", > datefmt='%d%m %H%M%S.',) > > if I use it, and delete the logfile it will not create the logfile > again. Only restart of the application will do. Is there any > workaround for this? > Hello Yaroslav, Once you create a FileHandler, the file "belongs" to the logging package which assumes it has exclusive access to the file. If the file is deleted, in order to log to it again, you need to remove the existing handler, close it, open a new handler, and attach it to the root logger. For this you will have to use the other logging API functions. Please post questions like this on comp.lang.python so that others can join in the discussion. Regards, Vinay Sajip
-- http://mail.python.org/mailman/listinfo/python-list