Fwd: Re: Logging question

Vinay Sajip at Red Dove vinay_sajip at red-dove.com
Wed Dec 16 12:31:59 EST 2009



-------- Original Message --------
Subject: 	Re: Logging question
Date: 	Tue, 15 Dec 2009 18:28:54 +0000
From: 	Vinay Sajip at Red Dove <vinay_sajip at red-dove.com>
To: 	Yaroslav Molochko <onorua at 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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091216/cb2ce8f6/attachment.html>


More information about the Python-list mailing list